1 ; RUN: opt -S -codegenprepare < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 define i64 @test1(i64 %A) {
7 ; CHECK: [[CTLZ:%[A-Za-z0-9]+]] = call i64 @llvm.ctlz.i64(i64 %A, i1 false)
8 ; CHECK-NEXT: ret i64 [[CTLZ]]
10 %tobool = icmp eq i64 %A, 0
11 br i1 %tobool, label %cond.end, label %cond.true
13 cond.true: ; preds = %entry
14 %0 = tail call i64 @llvm.ctlz.i64(i64 %A, i1 true)
17 cond.end: ; preds = %entry, %cond.true
18 %cond = phi i64 [ %0, %cond.true ], [ 64, %entry ]
22 define i64 @test1b(i64 %A) {
23 ; CHECK-LABEL: @test1b(
24 ; CHECK: [[CTTZ:%[A-Za-z0-9]+]] = call i64 @llvm.cttz.i64(i64 %A, i1 false)
25 ; CHECK-NEXT: ret i64 [[CTTZ]]
27 %tobool = icmp eq i64 %A, 0
28 br i1 %tobool, label %cond.end, label %cond.true
30 cond.true: ; preds = %entry
31 %0 = tail call i64 @llvm.cttz.i64(i64 %A, i1 true)
34 cond.end: ; preds = %entry, %cond.true
35 %cond = phi i64 [ %0, %cond.true ], [ 64, %entry ]
39 declare i64 @llvm.ctlz.i64(i64, i1)
40 declare i64 @llvm.cttz.i64(i64, i1)