[llvm-bugs] [Bug 29079] New: [X86][SSE] Failure to recognise uitofp conversions that can be performed as sitofp
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Aug 21 05:17:08 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=29079
Bug ID: 29079
Summary: [X86][SSE] Failure to recognise uitofp conversions
that can be performed as sitofp
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Related to [Bugzilla #29078]. If we have masked the sign bits of an integer
source then we can safely replace (slow) uitofp conversions with sitofp.
Note that it'd be even better if we can handle non-uniform masks!
define <4 x float> @mask_ucvt_4i32_4f32(<4 x i32> %a) {
%and = and <4 x i32> %a, <i32 255, i32 255, i32 255, i32 255>
%cvt = uitofp <4 x i32> %and to <4 x float>
ret <4 x float> %cvt
}
define <4 x double> @mask_ucvt_4i32_4f64(<4 x i32> %a) {
%and = and <4 x i32> %a, <i32 255, i32 255, i32 4095, i32 65595>
%cvt = uitofp <4 x i32> %and to <4 x double>
ret <4 x double> %cvt
}
"~/LLVM/build/bin/llc -mcpu=btver2"
_mask_ucvt_4i32_4f32:vpand LCPI0_0(%rip), %xmm0, %xmm0
vpblendw $170, LCPI0_1(%rip), %xmm0, %xmm1 ## xmm1 =
xmm0[0],mem[1],xmm0[2],mem[3],xmm0[4],mem[5],xmm0[6],mem[7]
vpsrld $16, %xmm0, %xmm0
vpblendw $170, LCPI0_2(%rip), %xmm0, %xmm0 ## xmm0 =
xmm0[0],mem[1],xmm0[2],mem[3],xmm0[4],mem[5],xmm0[6],mem[7]
vaddps LCPI0_3(%rip), %xmm0, %xmm0
vaddps %xmm0, %xmm1, %xmm0
retq
_mask_ucvt_4i32_4f64:
vpand LCPI1_0(%rip), %xmm0, %xmm0
vpand LCPI1_1(%rip), %xmm0, %xmm1
vpsrld $16, %xmm0, %xmm0
vcvtdq2pd %xmm0, %ymm0
vmulpd LCPI1_2(%rip), %ymm0, %ymm0
vcvtdq2pd %xmm1, %ymm1
vaddpd %ymm1, %ymm0, %ymm0
retq
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160821/0f764df0/attachment.html>
More information about the llvm-bugs
mailing list