1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -simplifycfg -mtriple=arm -mattr=+v6t2 < %s | FileCheck %s 3 4define i32 @ctlz(i32 %A) { 5; CHECK-LABEL: @ctlz( 6; CHECK-NEXT: entry: 7; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A:%.*]], 0 8; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ctlz.i32(i32 [[A]], i1 true) 9; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[TOBOOL]], i32 32, i32 [[TMP0]] 10; CHECK-NEXT: ret i32 [[SPEC_SELECT]] 11; 12entry: 13 %tobool = icmp eq i32 %A, 0 14 br i1 %tobool, label %cond.end, label %cond.true 15 16cond.true: 17 %0 = tail call i32 @llvm.ctlz.i32(i32 %A, i1 true) 18 br label %cond.end 19 20cond.end: 21 %cond = phi i32 [ %0, %cond.true ], [ 32, %entry ] 22 ret i32 %cond 23} 24 25define i32 @cttz(i32 %A) { 26; CHECK-LABEL: @cttz( 27; CHECK-NEXT: entry: 28; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A:%.*]], 0 29; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.cttz.i32(i32 [[A]], i1 true) 30; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[TOBOOL]], i32 32, i32 [[TMP0]] 31; CHECK-NEXT: ret i32 [[SPEC_SELECT]] 32; 33entry: 34 %tobool = icmp eq i32 %A, 0 35 br i1 %tobool, label %cond.end, label %cond.true 36 37cond.true: 38 %0 = tail call i32 @llvm.cttz.i32(i32 %A, i1 true) 39 br label %cond.end 40 41cond.end: 42 %cond = phi i32 [ %0, %cond.true ], [ 32, %entry ] 43 ret i32 %cond 44} 45 46declare i32 @llvm.ctlz.i32(i32, i1) 47declare i32 @llvm.cttz.i32(i32, i1) 48 49