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

Song, Ruiling ruiling.song at intel.com
Tue Oct 29 07:04:36 CET 2013


I have sent out V2 to correctly handle float and double type.
Please skip this old version.

-----Original Message-----
From: Song, Ruiling 
Sent: Monday, October 28, 2013 4:50 PM
To: beignet at lists.freedesktop.org
Cc: Song, Ruiling
Subject: [PATCH] GBE: Give a zero-initialized register for Undef value.

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