Although the immediate data type is 32 bit, the JMPI can only accept
the low 16 bit and will ignore the 16 msb. We need to add an assert here.

Signed-off-by: Zhigang Gong <[email protected]>
---
 backend/src/backend/gen_encoder.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/backend/src/backend/gen_encoder.cpp 
b/backend/src/backend/gen_encoder.cpp
index c372e36..11e27da 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -1054,8 +1054,9 @@ namespace gbe
 
   void GenEncoder::patchJMPI(uint32_t insnID, int32_t jumpDistance) {
     GenInstruction &insn = this->store[insnID];
-    assert(insnID < this->store.size());
-    assert(insn.header.opcode == GEN_OPCODE_JMPI);
+    GBE_ASSERT(insnID < this->store.size());
+    GBE_ASSERT(insn.header.opcode == GEN_OPCODE_JMPI);
+    GBE_ASSERT(jumpDistance < 32768 && jumpDistance >= -32768);
     this->setSrc1(&insn, GenRegister::immd(jumpDistance));
   }
 
-- 
1.7.9.5

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to