File: branch_coalesce.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (58 lines) | stat: -rw-r--r-- 2,504 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs -enable-ppc-branch-coalesce < %s | FileCheck %s
; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs -enable-ppc-branch-coalesce < %s | FileCheck %s
; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOCOALESCE %s
; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-NOCOALESCE %s

; Function Attrs: nounwind
define double @testBranchCoal(double %a, double %b, double %c, i32 %x) {
; CHECK-LABEL: testBranchCoal:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    cmplwi 6, 0
; CHECK-NEXT:    beq 0, .LBB0_2
; CHECK-NEXT:  # %bb.1: # %entry
; CHECK-NEXT:    addis 3, 2, .LCPI0_0@toc@ha
; CHECK-NEXT:    xxlxor 2, 2, 2
; CHECK-NEXT:    lfd 1, .LCPI0_0@toc@l(3)
; CHECK-NEXT:    addis 3, 2, .LCPI0_1@toc@ha
; CHECK-NEXT:    lfd 3, .LCPI0_1@toc@l(3)
; CHECK-NEXT:  .LBB0_2: # %entry
; CHECK-NEXT:    xsadddp 0, 1, 2
; CHECK-NEXT:    xsadddp 1, 0, 3
; CHECK-NEXT:    blr
;
; CHECK-NOCOALESCE-LABEL: testBranchCoal:
; CHECK-NOCOALESCE:       # %bb.0: # %entry
; CHECK-NOCOALESCE-NEXT:    cmplwi 6, 0
; CHECK-NOCOALESCE-NEXT:    bne 0, .LBB0_5
; CHECK-NOCOALESCE-NEXT:  # %bb.1: # %entry
; CHECK-NOCOALESCE-NEXT:    bne 0, .LBB0_6
; CHECK-NOCOALESCE-NEXT:  .LBB0_2: # %entry
; CHECK-NOCOALESCE-NEXT:    beq 0, .LBB0_4
; CHECK-NOCOALESCE-NEXT:  .LBB0_3: # %entry
; CHECK-NOCOALESCE-NEXT:    addis 3, 2, .LCPI0_1@toc@ha
; CHECK-NOCOALESCE-NEXT:    lfd 3, .LCPI0_1@toc@l(3)
; CHECK-NOCOALESCE-NEXT:  .LBB0_4: # %entry
; CHECK-NOCOALESCE-NEXT:    xsadddp 0, 1, 2
; CHECK-NOCOALESCE-NEXT:    xsadddp 1, 0, 3
; CHECK-NOCOALESCE-NEXT:    blr
; CHECK-NOCOALESCE-NEXT:  .LBB0_5: # %entry
; CHECK-NOCOALESCE-NEXT:    addis 3, 2, .LCPI0_0@toc@ha
; CHECK-NOCOALESCE-NEXT:    lfd 1, .LCPI0_0@toc@l(3)
; CHECK-NOCOALESCE-NEXT:    beq 0, .LBB0_2
; CHECK-NOCOALESCE-NEXT:  .LBB0_6: # %entry
; CHECK-NOCOALESCE-NEXT:    xxlxor 2, 2, 2
; CHECK-NOCOALESCE-NEXT:    bne 0, .LBB0_3
; CHECK-NOCOALESCE-NEXT:    b .LBB0_4

  entry:

  %test = icmp eq i32 %x, 0
  %tmp1 = select i1 %test, double %a, double 2.000000e-03
  %tmp2 = select i1 %test, double %b, double 0.000000e+00
  %tmp3 = select i1 %test, double %c, double 5.000000e-03

  %res1 = fadd double %tmp1, %tmp2
  %result = fadd double %res1, %tmp3
  ret double %result
}