1 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs -enable-ppc-branch-coalesce < %s | FileCheck %s
2 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs -enable-ppc-branch-coalesce < %s | FileCheck %s
3 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOCOALESCE %s
4 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOCOALESCE %s
6 ; Function Attrs: nounwind
7 define double @testBranchCoal(double %a, double %b, double %c, i32 %x) {
9 ; CHECK-LABEL: @testBranchCoal
10 ; CHECK: cmplwi [[CMPR:[0-7]+]], 6, 0
11 ; CHECK: beq [[CMPR]], .LBB[[LAB1:[0-9_]+]]
12 ; CHECK-DAG: addis [[LD1REG:[0-9]+]], 2, .LCPI0_0@toc@ha
13 ; CHECK-DAG: addis [[LD2REG:[0-9]+]], 2, .LCPI0_1@toc@ha
14 ; CHECK-DAG: xxlxor 2, 2, 2
16 ; CHECK-DAG: lfd 1, .LCPI0_0@toc@l([[LD1REG]])
17 ; CHECK-DAG: lfd 3, .LCPI0_1@toc@l([[LD2REG]])
19 ; CHECK: xsadddp 0, 1, 2
20 ; CHECK: xsadddp 1, 0, 3
23 ; CHECK-NOCOALESCE-LABEL: testBranchCoal:
24 ; CHECK-NOCOALESCE: # %bb.0: # %entry
25 ; CHECK-NOCOALESCE-NEXT: cmplwi 0, 6, 0
26 ; CHECK-NOCOALESCE-NEXT: bne 0, .LBB0_5
27 ; CHECK-NOCOALESCE-NEXT: # %bb.1: # %entry
28 ; CHECK-NOCOALESCE-NEXT: bne 0, .LBB0_6
29 ; CHECK-NOCOALESCE-NEXT: .LBB0_2: # %entry
30 ; CHECK-NOCOALESCE-NEXT: beq 0, .LBB0_4
31 ; CHECK-NOCOALESCE-NEXT: .LBB0_3: # %entry
32 ; CHECK-NOCOALESCE-NEXT: addis 3, 2, .LCPI0_1@toc@ha
33 ; CHECK-NOCOALESCE-NEXT: lfd 3, .LCPI0_1@toc@l(3)
34 ; CHECK-NOCOALESCE-NEXT: .LBB0_4: # %entry
35 ; CHECK-NOCOALESCE-NEXT: xsadddp 0, 1, 2
36 ; CHECK-NOCOALESCE-NEXT: xsadddp 1, 0, 3
37 ; CHECK-NOCOALESCE-NEXT: blr
38 ; CHECK-NOCOALESCE-NEXT: .LBB0_5: # %entry
39 ; CHECK-NOCOALESCE-NEXT: addis 3, 2, .LCPI0_0@toc@ha
40 ; CHECK-NOCOALESCE-NEXT: lfd 1, .LCPI0_0@toc@l(3)
41 ; CHECK-NOCOALESCE-NEXT: beq 0, .LBB0_2
42 ; CHECK-NOCOALESCE-NEXT: .LBB0_6: # %entry
43 ; CHECK-NOCOALESCE-NEXT: xxlxor 2, 2, 2
44 ; CHECK-NOCOALESCE-NEXT: bne 0, .LBB0_3
45 ; CHECK-NOCOALESCE-NEXT: b .LBB0_4
48 %test = icmp eq i32 %x, 0
49 %tmp1 = select i1 %test, double %a, double 2.000000e-03
50 %tmp2 = select i1 %test, double %b, double 0.000000e+00
51 %tmp3 = select i1 %test, double %c, double 5.000000e-03
53 %res1 = fadd double %tmp1, %tmp2
54 %result = fadd double %res1, %tmp3