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