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