From: Simon Pilgrim Date: Sat, 1 Apr 2023 19:19:27 +0000 (+0100) Subject: [X86] Add test showing failure to fold testc(X,~X) -> testc(X,-1) X-Git-Tag: upstream/17.0.6~12959 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf1bccf15c3582f0d59297a5feeb00080ca2c5f6;p=platform%2Fupstream%2Fllvm.git [X86] Add test showing failure to fold testc(X,~X) -> testc(X,-1) --- diff --git a/llvm/test/CodeGen/X86/combine-ptest.ll b/llvm/test/CodeGen/X86/combine-ptest.ll index 2b9edb1..bff6d5f 100644 --- a/llvm/test/CodeGen/X86/combine-ptest.ll +++ b/llvm/test/CodeGen/X86/combine-ptest.ll @@ -150,6 +150,26 @@ define i32 @ptestnzc_256_invert0_commute(<4 x i64> %c, <4 x i64> %d, i32 %a, i32 } ; +; TODO: testc(X,~X) -> testc(X,-1) +; + +define i32 @ptestc_128_not(<2 x i64> %c, <2 x i64> %d, i32 %a, i32 %b) { +; CHECK-LABEL: ptestc_128_not: +; CHECK: # %bb.0: +; CHECK-NEXT: movl %edi, %eax +; CHECK-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1 +; CHECK-NEXT: vpxor %xmm1, %xmm0, %xmm1 +; CHECK-NEXT: vptest %xmm1, %xmm0 +; CHECK-NEXT: cmovael %esi, %eax +; CHECK-NEXT: retq + %t1 = xor <2 x i64> %c, + %t2 = call i32 @llvm.x86.sse41.ptestc(<2 x i64> %c, <2 x i64> %t1) + %t3 = icmp ne i32 %t2, 0 + %t4 = select i1 %t3, i32 %a, i32 %b + ret i32 %t4 +} + +; ; testz(AND(X,Y),AND(X,Y)) -> testz(X,Y) ;