[PATCH] D146511: Precommit test for #61120
Jun Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 04:19:18 PDT 2023
junaire created this revision.
Herald added a subscriber: pengfei.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Signed-off-by: Jun Zhang <jun at junz.org>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146511
Files:
llvm/test/CodeGen/X86/setcc-combine.ll
Index: llvm/test/CodeGen/X86/setcc-combine.ll
===================================================================
--- llvm/test/CodeGen/X86/setcc-combine.ll
+++ llvm/test/CodeGen/X86/setcc-combine.ll
@@ -499,3 +499,82 @@
%r = select i1 %cmp, double %x, double %neg
ret double %r
}
+
+define i64 @cmp_sgt(i64 %a, i64 %b) {
+; CHECK-LABEL: cmp_sgt:
+; CHECK: # %bb.0:
+; CHECK-NEXT: notq %rdi
+; CHECK-NEXT: notq %rsi
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: cmpq %rsi, %rdi
+; CHECK-NEXT: setg %al
+; CHECK-NEXT: negq %rax
+; CHECK-NEXT: retq
+ %na = xor i64 %a, -1
+ %nb = xor i64 %b, -1
+ %c = icmp sgt i64 %na, %nb
+ %r = sext i1 %c to i64
+ ret i64 %r
+}
+
+define <2 x i64> @cmp_sgt_vec(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: cmp_sgt_vec:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movdqa {{.*#+}} xmm2 = [18446744071562067967,18446744071562067967]
+; CHECK-NEXT: pxor %xmm2, %xmm1
+; CHECK-NEXT: pxor %xmm2, %xmm0
+; CHECK-NEXT: movdqa %xmm0, %xmm2
+; CHECK-NEXT: pcmpgtd %xmm1, %xmm2
+; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
+; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
+; CHECK-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
+; CHECK-NEXT: pand %xmm3, %xmm1
+; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,1,3,3]
+; CHECK-NEXT: por %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %na = xor <2 x i64> %a, <i64 -1, i64 -1>
+ %nb = xor <2 x i64> %b, <i64 -1, i64 -1>
+ %c = icmp sgt <2 x i64> %na, %nb
+ %r = sext <2 x i1> %c to <2 x i64>
+ ret <2 x i64> %r
+}
+
+define i64 @cmp_ule(i64 %a, i64 %b) {
+; CHECK-LABEL: cmp_ule:
+; CHECK: # %bb.0:
+; CHECK-NEXT: notq %rdi
+; CHECK-NEXT: notq %rsi
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: cmpq %rdi, %rsi
+; CHECK-NEXT: adcq $-1, %rax
+; CHECK-NEXT: retq
+ %na = xor i64 %a, -1
+ %nb = xor i64 %b, -1
+ %c = icmp ule i64 %na, %nb
+ %r = sext i1 %c to i64
+ ret i64 %r
+}
+
+define <2 x i64> @cmp_ule_vec(<2 x i64> %a, <2 x i64> %b) {
+; CHECK-LABEL: cmp_ule_vec:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movdqa {{.*#+}} xmm2 = [9223372034707292159,9223372034707292159]
+; CHECK-NEXT: pxor %xmm2, %xmm1
+; CHECK-NEXT: pxor %xmm2, %xmm0
+; CHECK-NEXT: movdqa %xmm0, %xmm2
+; CHECK-NEXT: pcmpgtd %xmm1, %xmm2
+; CHECK-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,2,2]
+; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
+; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
+; CHECK-NEXT: pand %xmm3, %xmm0
+; CHECK-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
+; CHECK-NEXT: por %xmm0, %xmm1
+; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
+; CHECK-NEXT: pxor %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %na = xor <2 x i64> %a, <i64 -1, i64 -1>
+ %nb = xor <2 x i64> %b, <i64 -1, i64 -1>
+ %c = icmp ule <2 x i64> %na, %nb
+ %r = sext <2 x i1> %c to <2 x i64>
+ ret <2 x i64> %r
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146511.506908.patch
Type: text/x-patch
Size: 2835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230321/515159ae/attachment.bin>
More information about the llvm-commits
mailing list