[Beignet] [PATCH 2/2] gbe: fix uitofp instruction issue.
xionghu.luo at intel.com
xionghu.luo at intel.com
Mon Nov 9 22:48:25 PST 2015
From: Meng Mengmeng <mengmeng.meng at intel.com>
llvm 3.7 may generate cast instructions "%13 = uitofp i1 %12 to float",
while the dst type is float or double , should call the coresponding
newXXXimmediate function.
---
backend/src/llvm/llvm_gen_backend.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 7299d53..717e3f3 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -3144,11 +3144,21 @@ namespace gbe
// We use a select (0,1) not a convert when the destination is a boolean
if (srcType == ir::TYPE_BOOL) {
const ir::RegisterFamily family = getFamily(dstType);
- const ir::ImmediateIndex zero = ctx.newIntegerImmediate(0, dstType);
+ ir::ImmediateIndex zero;
+ if(dstType == ir::TYPE_FLOAT)
+ zero = ctx.newFloatImmediate(0);
+ else if(dstType == ir::TYPE_DOUBLE)
+ zero = ctx.newDoubleImmediate(0);
+ else
+ zero = ctx.newIntegerImmediate(0, dstType);
ir::ImmediateIndex one;
if (I.getOpcode() == Instruction::SExt
&& (dstType == ir::TYPE_S8 || dstType == ir::TYPE_S16 || dstType == ir::TYPE_S32 || dstType == ir::TYPE_S64))
one = ctx.newIntegerImmediate(-1, dstType);
+ else if(dstType == ir::TYPE_FLOAT)
+ one = ctx.newFloatImmediate(1);
+ else if(dstType == ir::TYPE_DOUBLE)
+ one = ctx.newDoubleImmediate(1);
else
one = ctx.newIntegerImmediate(1, dstType);
const ir::Register zeroReg = ctx.reg(family);
--
1.9.1
More information about the Beignet
mailing list