1 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0.0 | FileCheck %s
3 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5 ; Function Attrs: nounwind readnone
6 declare i32 @llvm.ctlz.i32(i32, i1) #0
7 declare i64 @llvm.ctlz.i64(i64, i1) #1
9 ; Function Attrs: nounwind ssp
10 define i32 @clrsb32(i32 %x) #2 {
12 %shr = ashr i32 %x, 31
13 %xor = xor i32 %shr, %x
14 %mul = shl i32 %xor, 1
16 %0 = tail call i32 @llvm.ctlz.i32(i32 %add, i1 false)
19 ; CHECK-LABEL: clrsb32
20 ; CHECK: cls [[TEMP:w[0-9]+]], [[TEMP]]
23 ; Function Attrs: nounwind ssp
24 define i64 @clrsb64(i64 %x) #3 {
26 %shr = ashr i64 %x, 63
27 %xor = xor i64 %shr, %x
28 %mul = shl nsw i64 %xor, 1
30 %0 = tail call i64 @llvm.ctlz.i64(i64 %add, i1 false)
33 ; CHECK-LABEL: clrsb64
34 ; CHECK: cls [[TEMP:x[0-9]+]], [[TEMP]]