1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 define i64 @foo(i64 %x, i64 %y) {
7 ; CHECK-NEXT: bsrq %rdi, %rax
8 ; CHECK-NEXT: xorq $64, %rax
9 ; CHECK-NEXT: bsrq %rsi, %rcx
10 ; CHECK-NEXT: cmoveq %rax, %rcx
11 ; CHECK-NEXT: movl $63, %eax
12 ; CHECK-NEXT: subq %rcx, %rax
14 %1 = tail call i64 @llvm.ctlz.i64(i64 %x, i1 true)
16 %3 = tail call i64 @llvm.ctlz.i64(i64 %y, i1 true)
18 %5 = icmp eq i64 %y, 0
19 %6 = select i1 %5, i64 %2, i64 %4
20 %7 = sub nsw i64 63, %6
24 declare i64 @llvm.ctlz.i64(i64, i1)