1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -verify-machineinstrs -ppc-gen-isel=false | FileCheck --check-prefix=CHECK-NO-ISEL %s
3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4 target triple = "powerpc64-unknown-linux-gnu"
6 define i32 @test(i32 %a, i32 %b, i32 %c, i32 %d) {
8 %sext82 = shl i32 %d, 16
9 %conv29 = ashr exact i32 %sext82, 16
10 %cmp = icmp slt i32 %sext82, 0
11 br i1 %cmp, label %cond.true, label %cond.false
13 cond.true: ; preds = %sw.epilog
14 %and33 = and i32 %conv29, 32767
15 %sub34 = sub nsw i32 %a, %and33
18 cond.false: ; preds = %sw.epilog
19 %add37 = add nsw i32 %conv29, %a
23 ; CHECK-NO-ISEL-LABEL: @test
24 ; CHECK: add [[REG:[0-9]+]],
25 ; CHECK: subf [[REG2:[0-9]+]],
26 ; CHECK: isel {{[0-9]+}}, [[REG]], [[REG2]],
27 ; CHECK-NO-ISEL: bc 12, 1, [[TRUE:.LBB[0-9]+]]
28 ; CHECK-NO-ISEL-NEXT: b [[SUCCESSOR:.LBB[0-9]+]]
29 ; CHECK-NO-ISEL: [[TRUE]]
30 ; CHECK-NO-ISEL-NEXT: addi 5, 6, 0
31 ; CHECK-NO-ISEL: extsh 5, 5
32 ; CHECK-NO-ISEL-NEXT: add 3, 3, 5
33 ; CHECK-NO-ISEL-NEXT: blr
35 cond.end: ; preds = %cond.false, %cond.true
36 %cond = phi i32 [ %sub34, %cond.true ], [ %add37, %cond.false ]
37 %sext83 = shl i32 %cond, 16
38 %conv39 = ashr exact i32 %sext83, 16
39 %add41 = sub i32 %b, %a
40 %sub43 = add i32 %add41, %conv39