Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 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 |
Nemanja Ivanovic | b223cfa | 2017-03-01 20:29:34 +0000 | [diff] [blame] | 5 | |
| 6 | ; Function Attrs: nounwind |
| 7 | define double @testBranchCoal(double %a, double %b, double %c, i32 %x) { |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 8 | |
| 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 |
| 15 | ; CHECK-NOT: beq |
QingShan Zhang | f8f9af7 | 2018-08-20 02:52:55 +0000 | [diff] [blame] | 16 | ; CHECK-DAG: lfd 1, .LCPI0_0@toc@l([[LD1REG]]) |
| 17 | ; CHECK-DAG: lfd 3, .LCPI0_1@toc@l([[LD2REG]]) |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 18 | ; CHECK: .LBB[[LAB1]] |
| 19 | ; CHECK: xsadddp 0, 1, 2 |
| 20 | ; CHECK: xsadddp 1, 0, 3 |
| 21 | ; CHECK: blr |
| 22 | |
| 23 | ; CHECK-NOCOALESCE-LABEL: testBranchCoal: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 24 | ; CHECK-NOCOALESCE: # %bb.0: # %entry |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 25 | ; CHECK-NOCOALESCE-NEXT: cmplwi 0, 6, 0 |
| 26 | ; CHECK-NOCOALESCE-NEXT: bne 0, .LBB0_5 |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 27 | ; CHECK-NOCOALESCE-NEXT: # %bb.1: # %entry |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 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 |
QingShan Zhang | f8f9af7 | 2018-08-20 02:52:55 +0000 | [diff] [blame] | 33 | ; CHECK-NOCOALESCE-NEXT: lfd 3, .LCPI0_1@toc@l(3) |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 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 |
QingShan Zhang | f8f9af7 | 2018-08-20 02:52:55 +0000 | [diff] [blame] | 40 | ; CHECK-NOCOALESCE-NEXT: lfd 1, .LCPI0_0@toc@l(3) |
Lei Huang | 34e6621 | 2017-09-12 18:39:11 +0000 | [diff] [blame] | 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 |
| 46 | entry: |
| 47 | |
Nemanja Ivanovic | b223cfa | 2017-03-01 20:29:34 +0000 | [diff] [blame] | 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 |
| 52 | |
| 53 | %res1 = fadd double %tmp1, %tmp2 |
| 54 | %result = fadd double %res1, %tmp3 |
| 55 | ret double %result |
Nemanja Ivanovic | b223cfa | 2017-03-01 20:29:34 +0000 | [diff] [blame] | 56 | } |