1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=arm -mattr=+v6t2 < %s | FileCheck %s
4 define i32 @ctlz(i32 %A) {
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]]
13 %tobool = icmp eq i32 %A, 0
14 br i1 %tobool, label %cond.end, label %cond.true
17 %0 = tail call i32 @llvm.ctlz.i32(i32 %A, i1 true)
21 %cond = phi i32 [ %0, %cond.true ], [ 32, %entry ]
25 define i32 @cttz(i32 %A) {
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]]
34 %tobool = icmp eq i32 %A, 0
35 br i1 %tobool, label %cond.end, label %cond.true
38 %0 = tail call i32 @llvm.cttz.i32(i32 %A, i1 true)
42 %cond = phi i32 [ %0, %cond.true ], [ 32, %entry ]
46 declare i32 @llvm.ctlz.i32(i32, i1)
47 declare i32 @llvm.cttz.i32(i32, i1)