[Beignet] [PATCH] GBE: Give a zero-initialized register for Undef value.

Ruiling Song ruiling.song at intel.com
Mon Oct 28 09:50:03 CET 2013


For instructions that reference an undef value, we simply
allocate a register to the undef operand and set as 0.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/llvm/llvm_gen_backend.cpp |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 62d6eab..b06ca33 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -879,6 +879,13 @@ namespace gbe
     if(isa<GlobalValue>(c)) {
       return regTranslator.getScalar(c, elemID);
     }
+    if(isa<UndefValue>(c)) {
+      ir::Type dstType = getType(ctx, c->getType());
+      ir::Register reg = ctx.reg(getFamily(dstType));
+      ir::ImmediateIndex immIndex = ctx.newIntegerImmediate(0, dstType);
+      ctx.LOADI(dstType, reg, immIndex);
+      return reg;
+    }
 
     if(isa<ConstantExpr>(c)) {
       ConstantExpr * ce = dyn_cast<ConstantExpr>(c);
-- 
1.7.9.5



More information about the Beignet mailing list