1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
3 target datalayout = "E-m:e-i64:64-n32:64"
4 target triple = "powerpc64-unknown-linux-gnu"
6 define i64 @test1(i64 %A) {
9 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[A:%.*]], 0
10 ; CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ctlz.i64(i64 [[A]], i1 true)
11 ; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[TOBOOL]], i64 64, i64 [[TMP0]]
12 ; CHECK-NEXT: ret i64 [[SPEC_SELECT]]
15 %tobool = icmp eq i64 %A, 0
16 br i1 %tobool, label %cond.end, label %cond.true
18 cond.true: ; preds = %entry
19 %0 = tail call i64 @llvm.ctlz.i64(i64 %A, i1 true)
22 cond.end: ; preds = %entry, %cond.true
23 %cond = phi i64 [ %0, %cond.true ], [ 64, %entry ]
27 define i64 @test1b(i64 %A) {
28 ; CHECK-LABEL: @test1b(
30 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[A:%.*]], 0
31 ; CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.cttz.i64(i64 [[A]], i1 true)
32 ; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[TOBOOL]], i64 64, i64 [[TMP0]]
33 ; CHECK-NEXT: ret i64 [[SPEC_SELECT]]
36 %tobool = icmp eq i64 %A, 0
37 br i1 %tobool, label %cond.end, label %cond.true
39 cond.true: ; preds = %entry
40 %0 = tail call i64 @llvm.cttz.i64(i64 %A, i1 true)
43 cond.end: ; preds = %entry, %cond.true
44 %cond = phi i64 [ %0, %cond.true ], [ 64, %entry ]
48 declare i64 @llvm.ctlz.i64(i64, i1)
49 declare i64 @llvm.cttz.i64(i64, i1)