diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-02-26 21:39:12 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-02-26 21:39:12 +0000 |
commit | 685b0d9315c0e4305113e8a92b1891908c3f5fe6 (patch) | |
tree | 92c7f9337edf2a441446385d0fe30cbfc063c5f1 /test/CodeGen/X86/vec_setcc.ll | |
parent | c540920a247aefd90bf5c79d4969ed9a963bd3f1 (diff) | |
download | llvm-685b0d9315c0e4305113e8a92b1891908c3f5fe6.tar.gz llvm-685b0d9315c0e4305113e8a92b1891908c3f5fe6.tar.bz2 llvm-685b0d9315c0e4305113e8a92b1891908c3f5fe6.tar.xz |
Lower unsigned vsetcc to psubus in certain cases
The current approach to lower a vsetult is to flip the sign bit of the
operands, swap the operands and then use a (signed) pcmpgt. psubus (unsigned
saturating subtract) can be used to emulate a vsetult more efficiently:
+ case ISD::SETULT: {
+ // If the comparison is against a constant we can turn this into a
+ // setule. With psubus, setule does not require a swap. This is
+ // beneficial because the constant in the register is no longer
+ // destructed as the destination so it can be hoisted out of a loop.
I also enable lowering via psubus in a few other cases where it's clearly
beneficial: setule and setuge if minu/maxu cannot be used.
rdar://problem/14338765
Patch by Adam Nemet <anemet@apple.com>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/vec_setcc.ll')
-rw-r--r-- | test/CodeGen/X86/vec_setcc.ll | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/test/CodeGen/X86/vec_setcc.ll b/test/CodeGen/X86/vec_setcc.ll index fc8a56de79..322dbae0c8 100644 --- a/test/CodeGen/X86/vec_setcc.ll +++ b/test/CodeGen/X86/vec_setcc.ll @@ -42,12 +42,9 @@ define <8 x i16> @v8i16_icmp_uge(<8 x i16> %a, <8 x i16> %b) nounwind readnone s %2 = sext <8 x i1> %1 to <8 x i16> ret <8 x i16> %2 ; SSE2-LABEL: v8i16_icmp_uge: -; SSE2: movdqa {{.*}}(%rip), %xmm2 -; SEE2: pxor %xmm2, %xmm0 -; SSE2: pxor %xmm1, %xmm2 -; SSE2: pcmpgtw %xmm0, %xmm2 -; SSE2: pcmpeqd %xmm0, %xmm0 -; SSE2: pxor %xmm2, %xmm0 +; SSE2: psubusw %xmm0, %xmm1 +; SEE2: pxor %xmm0, %xmm0 +; SSE2: pcmpeqw %xmm1, %xmm0 ; SSE41-LABEL: v8i16_icmp_uge: ; SSE41: pmaxuw %xmm0, %xmm1 @@ -63,12 +60,9 @@ define <8 x i16> @v8i16_icmp_ule(<8 x i16> %a, <8 x i16> %b) nounwind readnone s %2 = sext <8 x i1> %1 to <8 x i16> ret <8 x i16> %2 ; SSE2-LABEL: v8i16_icmp_ule: -; SSE2: movdqa {{.*}}(%rip), %xmm2 -; SSE2: pxor %xmm2, %xmm1 -; SSE2: pxor %xmm2, %xmm0 -; SSE2: pcmpgtw %xmm1, %xmm0 -; SSE2: pcmpeqd %xmm1, %xmm1 -; SSE2: pxor %xmm0, %xmm1 +; SSE2: psubusw %xmm1, %xmm0 +; SSE2: pxor %xmm1, %xmm1 +; SSE2: pcmpeqw %xmm0, %xmm1 ; SSE2: movdqa %xmm1, %xmm0 ; SSE41-LABEL: v8i16_icmp_ule: |