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

Xing, Homer homer.xing at intel.com
Tue Oct 29 01:24:36 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 Zhigang Gong
Sent: Monday, October 28, 2013 5:46 PM
To: beignet at lists.freedesktop.org
Cc: Zhigang Gong
Subject: [Beignet] [PATCH v2] GBE: fix a bug for the cast(FPToUI) instruction.

We need to choose unsigned dst type for this case.

v2:
fix a typo.

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..c2ed4b9 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, llvmDstType);
         ir::Type srcType;
         if (I.getOpcode() == Instruction::ZExt || I.getOpcode() == Instruction::UIToFP) {
           srcType = getUnsignedType(ctx, llvmSrcType);
-- 
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