1; RUN: llc -verify-machineinstrs -mcpu=pwr8 < %s | FileCheck %s
2; RUN: llc -verify-machineinstrs -mcpu=pwr8 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s
3target datalayout = "E-m:e-i64:64-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6; Function Attrs: nounwind
7define void @foo(i32* nocapture %r1, i32* nocapture %r2, i32* nocapture %r3, i32* nocapture %r4, i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d) #0 {
8entry:
9  %tobool = icmp ne i32 %a, 0
10  %cond = select i1 %tobool, i32 %b, i32 %c
11  store i32 %cond, i32* %r1, align 4
12  %cond5 = select i1 %tobool, i32 %b, i32 %d
13  store i32 %cond5, i32* %r2, align 4
14  %add = add nsw i32 %b, 1
15  %sub = add nsw i32 %d, -2
16  %cond10 = select i1 %tobool, i32 %add, i32 %sub
17  store i32 %cond10, i32* %r3, align 4
18  %add13 = add nsw i32 %b, 3
19  %sub15 = add nsw i32 %d, -5
20  %cond17 = select i1 %tobool, i32 %add13, i32 %sub15
21  store i32 %cond17, i32* %r4, align 4
22  ret void
23}
24
25; Make sure that we don't schedule all of the isels together, they should be
26; intermixed with the adds because each isel starts a new dispatch group.
27; CHECK-LABEL: @foo
28; CHECK-NO-ISEL-LABEL: @foo
29; CHECK: isel
30; CHECK-NO-ISEL: bc 12, 2, [[TRUE:.LBB[0-9]+]]
31; CHECK-NO-ISEL: b [[SUCCESSOR:.LBB[0-9]+]]
32; CHECK-NO-ISEL: [[TRUE]]
33; CHECK-NO-ISEL-NEXT: addi {{[0-9]+}}, {{[0-9]+}}, 0
34; CHECK: addi
35; CHECK: isel
36; CHECK-NO-ISEL: bc 12, 2, [[TRUE:.LBB[0-9]+]]
37; CHECK-NO-ISEL: ori 10, 11, 0
38; CHECK-NO-ISEL-NEXT: b [[SUCCESSOR:.LBB[0-9]+]]
39; CHECK-NO-ISEL: [[TRUE]]
40; CHECK: blr
41
42attributes #0 = { nounwind }
43