Skip to content

Commit 360a43f

Browse files
RKSimontomtor
authored andcommitted
[X86] pr40090.ll - add ctlz(x,false) (zero isn't poison) test coverage
1 parent b0f3a61 commit 360a43f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/test/CodeGen/X86/pr40090.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,26 @@ define i64 @foo(i64 %x, i64 %y) {
2121
ret i64 %7
2222
}
2323

24+
define i64 @bar(i64 %x, i64 %y) {
25+
; CHECK-LABEL: bar:
26+
; CHECK: # %bb.0:
27+
; CHECK-NEXT: movl $127, %ecx
28+
; CHECK-NEXT: movl $127, %eax
29+
; CHECK-NEXT: bsrq %rdi, %rax
30+
; CHECK-NEXT: xorq $64, %rax
31+
; CHECK-NEXT: bsrq %rsi, %rcx
32+
; CHECK-NEXT: cmoveq %rax, %rcx
33+
; CHECK-NEXT: movl $63, %eax
34+
; CHECK-NEXT: subq %rcx, %rax
35+
; CHECK-NEXT: retq
36+
%1 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 false)
37+
%2 = xor i64 %1, 127
38+
%3 = tail call i64 @llvm.ctlz.i64(i64 %y, i1 false)
39+
%4 = xor i64 %3, 63
40+
%5 = icmp eq i64 %y, 0
41+
%6 = select i1 %5, i64 %2, i64 %4
42+
%7 = sub nsw i64 63, %6
43+
ret i64 %7
44+
}
45+
2446
declare i64 @llvm.ctlz.i64(i64, i1)

0 commit comments

Comments
 (0)