[Beignet] [PATCH] GBE: fix a bug for the cast(FPToUI) instruction.

Zhigang Gong zhigang.gong at linux.intel.com
Mon Oct 28 10:01:08 CET 2013


We need to choose unsigned dst type for this case.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 backend/src/llvm/llvm_gen_backend.cpp |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 62d6eab..ebd3a33 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1660,7 +1660,11 @@ namespace gbe
         // Get the element type for a vector
         Type *llvmDstType = I.getType();
         Type *llvmSrcType = I.getOperand(0)->getType();
-        const ir::Type dstType = getType(ctx, llvmDstType);
+        ir::Type dstType;
+        if (I.getOpcode() == Instruction::FPToUI)
+          dstType = getUnsignedType(ctx, llvmDstType);
+        else
+          dstType = getType(ctx, llvmSrcType);
         ir::Type srcType;
         if (I.getOpcode() == Instruction::ZExt || I.getOpcode() == Instruction::UIToFP) {
           srcType = getUnsignedType(ctx, llvmSrcType);
-- 
1.7.9.5



More information about the Beignet mailing list