[Beignet] [Patch v2 2/2] gbe: fix uitofp instruction issue.
Yang, Rong R
rong.r.yang at intel.com
Tue Nov 10 23:50:35 PST 2015
The patchset LGTM, thanks.
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> xionghu.luo at intel.com
> Sent: Wednesday, November 11, 2015 15:35
> To: beignet at lists.freedesktop.org
> Cc: Luo, Xionghu
> Subject: [Beignet] [Patch v2 2/2] gbe: fix uitofp instruction issue.
>
> From: Luo Xionghu <xionghu.luo 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.
>
> Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
> ---
> 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
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list