[llvm] e554cec - [DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 11 06:30:12 PST 2023


Author: Simon Pilgrim
Date: 2023-03-11T14:25:47Z
New Revision: e554cec49a12824820ca3b8844b0f71620c0760d

URL: https://github.com/llvm/llvm-project/commit/e554cec49a12824820ca3b8844b0f71620c0760d
DIFF: https://github.com/llvm/llvm-project/commit/e554cec49a12824820ca3b8844b0f71620c0760d.diff

LOG: [DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/test-vs-bittest.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/test-vs-bittest.ll b/llvm/test/CodeGen/X86/test-vs-bittest.ll
index b22336e62a14e..f936e5f7e95c5 100644
--- a/llvm/test/CodeGen/X86/test-vs-bittest.ll
+++ b/llvm/test/CodeGen/X86/test-vs-bittest.ll
@@ -571,6 +571,22 @@ define i64 @is_upper_bit_clear_i64(i64 %x) {
   ret i64 %r
 }
 
+define i32 @is_upper_bit_clear_i64_trunc(i64 %x) {
+; CHECK-LABEL: is_upper_bit_clear_i64_trunc:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    movq %rdi, %rax
+; CHECK-NEXT:    shrq $42, %rax
+; CHECK-NEXT:    notl %eax
+; CHECK-NEXT:    andl $1, %eax
+; CHECK-NEXT:    # kill: def $eax killed $eax killed $rax
+; CHECK-NEXT:    retq
+  %sh = lshr i64 %x, 42
+  %t = trunc i64 %sh to i32
+  %m = and i32 %t, 1
+  %r = xor i32 %m, 1
+  ret i32 %r
+}
+
 define i64 @is_upper_bit_clear_i64_not(i64 %x) {
 ; CHECK-LABEL: is_upper_bit_clear_i64_not:
 ; CHECK:       # %bb.0:


        


More information about the llvm-commits mailing list