1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0.0 | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0.0 -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 declare i32 @llvm.ctlz.i32(i32, i1) #0
8 declare i64 @llvm.ctlz.i64(i64, i1) #1
10 define i32 @clrsb32(i32 %x) #2 {
11 ; CHECK-LABEL: clrsb32:
12 ; CHECK: ; %bb.0: ; %entry
13 ; CHECK-NEXT: cls w0, w0
16 %shr = ashr i32 %x, 31
17 %xor = xor i32 %shr, %x
18 %mul = shl i32 %xor, 1
20 %0 = tail call i32 @llvm.ctlz.i32(i32 %add, i1 false)
24 define i64 @clrsb64(i64 %x) #3 {
25 ; CHECK-LABEL: clrsb64:
26 ; CHECK: ; %bb.0: ; %entry
27 ; CHECK-NEXT: cls x0, x0
30 %shr = ashr i64 %x, 63
31 %xor = xor i64 %shr, %x
32 %mul = shl nsw i64 %xor, 1
34 %0 = tail call i64 @llvm.ctlz.i64(i64 %add, i1 false)
38 define i32 @clrsb32_zeroundef(i32 %x) #2 {
39 ; CHECK-LABEL: clrsb32_zeroundef:
40 ; CHECK: ; %bb.0: ; %entry
41 ; CHECK-NEXT: cls w0, w0
44 %shr = ashr i32 %x, 31
45 %xor = xor i32 %shr, %x
46 %mul = shl i32 %xor, 1
48 %0 = tail call i32 @llvm.ctlz.i32(i32 %add, i1 true)
52 define i64 @clrsb64_zeroundef(i64 %x) #3 {
53 ; CHECK-LABEL: clrsb64_zeroundef:
54 ; CHECK: ; %bb.0: ; %entry
55 ; CHECK-NEXT: cls x0, x0
58 %shr = ashr i64 %x, 63
59 %xor = xor i64 %shr, %x
60 %mul = shl nsw i64 %xor, 1
62 %0 = tail call i64 @llvm.ctlz.i64(i64 %add, i1 true)
66 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: