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

Xing, Homer homer.xing at intel.com
Tue Oct 29 01:26:04 CET 2013


This patch looks good to me.

-----Original Message-----
From: beignet-bounces+homer.xing=intel.com at lists.freedesktop.org [mailto:beignet-bounces+homer.xing=intel.com at lists.freedesktop.org] On Behalf Of Ruiling Song
Sent: Monday, October 28, 2013 4:50 PM
To: beignet at lists.freedesktop.org
Cc: Song, Ruiling
Subject: [Beignet] [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

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list