blob: deb6d898c2e0bed543f0ecf897c2eab5a68c93d4 [file] [log] [blame]
Nemanja Ivanovicb223cfa2017-03-01 20:29:34 +00001; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs -enable-branch-coalesce=true < %s | FileCheck %s
2; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs -enable-branch-coalesce=true < %s | FileCheck %s
3
4; Function Attrs: nounwind
5define double @testBranchCoal(double %a, double %b, double %c, i32 %x) {
6entry:
7 %test = icmp eq i32 %x, 0
8 %tmp1 = select i1 %test, double %a, double 2.000000e-03
9 %tmp2 = select i1 %test, double %b, double 0.000000e+00
10 %tmp3 = select i1 %test, double %c, double 5.000000e-03
11
12 %res1 = fadd double %tmp1, %tmp2
13 %result = fadd double %res1, %tmp3
14 ret double %result
15
16; CHECK-LABEL: @testBranchCoal
17; CHECK: cmplwi [[CMPR:[0-7]+]], 6, 0
18; CHECK: beq [[CMPR]], .LBB[[LAB1:[0-9_]+]]
19; CHECK-DAG: addis [[LD1REG:[0-9]+]], 2, .LCPI0_0@toc@ha
20; CHECK-DAG: addis [[LD2REG:[0-9]+]], 2, .LCPI0_1@toc@ha
21; CHECK-DAG: xxlxor 2, 2, 2
22; CHECK-NOT: beq
23; CHECK-DAG: addi [[LD1BASE:[0-9]+]], [[LD1REG]]
24; CHECK-DAG: addi [[LD2BASE:[0-9]+]], [[LD2REG]]
25; CHECK-DAG: lxsdx 1, 0, [[LD1BASE]]
26; CHECK-DAG: lxsdx 3, 0, [[LD2BASE]]
27; CHECK: .LBB[[LAB1]]
28; CHECK: xsadddp 0, 1, 2
29; CHECK: xsadddp 1, 0, 3
30; CHECK: blr
31}