1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple powerpc64le-unknown-linux | FileCheck %s
3 ; RUN: llc < %s -mtriple powerpc64le-unknown-linux -debug-only=machine-scheduler \
4 ; RUN: 2>&1 | FileCheck %s --check-prefix=LOG
7 define double @in_nostrict(double %a, double %b, double %c, double %d) {
8 ; CHECK-LABEL: in_nostrict:
9 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: xsdivdp 1, 1, 2
12 ; CHECK-NEXT: xsadddp 1, 1, 3
13 ; CHECK-NEXT: xsadddp 0, 1, 0
14 ; CHECK-NEXT: mtfsf 255, 4
15 ; CHECK-NEXT: xsdivdp 1, 3, 4
16 ; CHECK-NEXT: xsadddp 1, 1, 2
17 ; CHECK-NEXT: xsadddp 1, 0, 1
20 ; LOG: *** MI Scheduling ***
21 ; LOG-NEXT: in_nostrict:%bb.0 entry
22 ; LOG: ExitSU: MTFSF 255, %{{[0-9]+}}:f8rc, 0, 0
23 ; LOG: *** MI Scheduling ***
24 ; LOG-NEXT: in_nostrict:%bb.0 entry
25 ; LOG: ExitSU: %{{[0-9]+}}:f8rc = MFFS implicit $rm
27 ; LOG: *** MI Scheduling ***
28 ; LOG-NEXT: in_nostrict:%bb.0 entry
29 ; LOG: ExitSU: MTFSF 255, renamable $f{{[0-9]+}}, 0, 0
31 %0 = tail call double @llvm.ppc.readflm()
32 %1 = fdiv double %a, %b
33 %2 = fadd double %1, %c
34 %3 = fadd double %2, %0
35 call double @llvm.ppc.setflm(double %d)
36 %5 = fdiv double %c, %d
37 %6 = fadd double %5, %b
38 %7 = fadd double %3, %6
42 define double @in_strict(double %a, double %b, double %c, double %d) #0 {
43 ; CHECK-LABEL: in_strict:
44 ; CHECK: # %bb.0: # %entry
46 ; CHECK-NEXT: xsdivdp 1, 1, 2
47 ; CHECK-NEXT: xsadddp 1, 1, 3
48 ; CHECK-NEXT: xsadddp 0, 1, 0
49 ; CHECK-NEXT: mtfsf 255, 4
50 ; CHECK-NEXT: xsdivdp 1, 3, 4
51 ; CHECK-NEXT: xsadddp 1, 1, 2
52 ; CHECK-NEXT: xsadddp 1, 0, 1
55 ; LOG: ***** MI Scheduling *****
56 ; LOG-NEXT: in_strict:%bb.0 entry
57 ; LOG: ExitSU: MTFSF 255, %{{[0-9]+}}:f8rc, 0, 0
58 ; LOG: ***** MI Scheduling *****
59 ; LOG-NEXT: in_strict:%bb.0 entry
60 ; LOG: ExitSU: %{{[0-9]+}}:f8rc = MFFS implicit $rm
62 ; LOG: ***** MI Scheduling *****
63 ; LOG-NEXT: in_strict:%bb.0 entry
64 ; LOG: ExitSU: MTFSF 255, renamable $f{{[0-9]+}}, 0, 0
66 %0 = tail call double @llvm.ppc.readflm()
67 %1 = call double @llvm.experimental.constrained.fdiv.f64(double %a, double %b, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
68 %2 = call double @llvm.experimental.constrained.fadd.f64(double %1, double %c, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
69 %3 = call double @llvm.experimental.constrained.fadd.f64(double %2, double %0, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
70 call double @llvm.ppc.setflm(double %d)
71 %5 = call double @llvm.experimental.constrained.fdiv.f64(double %c, double %d, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
72 %6 = call double @llvm.experimental.constrained.fadd.f64(double %5, double %b, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
73 %7 = call double @llvm.experimental.constrained.fadd.f64(double %3, double %6, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
77 define void @cse_nomerge(ptr %f1, ptr %f2, double %f3) #0 {
78 ; CHECK-LABEL: cse_nomerge:
79 ; CHECK: # %bb.0: # %entry
81 ; CHECK-NEXT: .cfi_def_cfa_offset 64
82 ; CHECK-NEXT: .cfi_offset lr, 16
83 ; CHECK-NEXT: .cfi_offset r30, -24
84 ; CHECK-NEXT: .cfi_offset f31, -8
85 ; CHECK-NEXT: std 30, -24(1) # 8-byte Folded Spill
86 ; CHECK-NEXT: stfd 31, -8(1) # 8-byte Folded Spill
87 ; CHECK-NEXT: stdu 1, -64(1)
88 ; CHECK-NEXT: std 0, 80(1)
89 ; CHECK-NEXT: fmr 31, 1
90 ; CHECK-NEXT: mr 30, 4
92 ; CHECK-NEXT: stfd 0, 0(3)
93 ; CHECK-NEXT: bl effect_func
96 ; CHECK-NEXT: stfd 0, 0(30)
97 ; CHECK-NEXT: mtfsf 255, 31
98 ; CHECK-NEXT: addi 1, 1, 64
99 ; CHECK-NEXT: ld 0, 16(1)
100 ; CHECK-NEXT: lfd 31, -8(1) # 8-byte Folded Reload
101 ; CHECK-NEXT: ld 30, -24(1) # 8-byte Folded Reload
105 %0 = call double @llvm.ppc.readflm()
106 store double %0, ptr %f1, align 8
107 call void @effect_func()
108 %1 = call double @llvm.ppc.readflm()
109 store double %1, ptr %f2, align 8
110 %2 = call contract double @llvm.ppc.setflm(double %f3)
114 define void @cse_nomerge_readonly(ptr %f1, ptr %f2, double %f3) #0 {
115 ; CHECK-LABEL: cse_nomerge_readonly:
116 ; CHECK: # %bb.0: # %entry
118 ; CHECK-NEXT: .cfi_def_cfa_offset 64
119 ; CHECK-NEXT: .cfi_offset lr, 16
120 ; CHECK-NEXT: .cfi_offset r30, -24
121 ; CHECK-NEXT: .cfi_offset f31, -8
122 ; CHECK-NEXT: std 30, -24(1) # 8-byte Folded Spill
123 ; CHECK-NEXT: stfd 31, -8(1) # 8-byte Folded Spill
124 ; CHECK-NEXT: stdu 1, -64(1)
125 ; CHECK-NEXT: std 0, 80(1)
126 ; CHECK-NEXT: fmr 31, 1
127 ; CHECK-NEXT: mr 30, 4
129 ; CHECK-NEXT: stfd 0, 0(3)
130 ; CHECK-NEXT: bl readonly_func
133 ; CHECK-NEXT: stfd 0, 0(30)
134 ; CHECK-NEXT: mtfsf 255, 31
135 ; CHECK-NEXT: addi 1, 1, 64
136 ; CHECK-NEXT: ld 0, 16(1)
137 ; CHECK-NEXT: lfd 31, -8(1) # 8-byte Folded Reload
138 ; CHECK-NEXT: ld 30, -24(1) # 8-byte Folded Reload
142 %0 = call double @llvm.ppc.readflm()
143 store double %0, ptr %f1, align 8
144 call void @readonly_func()
145 %1 = call double @llvm.ppc.readflm()
146 store double %1, ptr %f2, align 8
147 %2 = call contract double @llvm.ppc.setflm(double %f3)
151 define double @mffsl() {
152 ; CHECK-LABEL: mffsl:
153 ; CHECK: # %bb.0: # %entry
154 ; CHECK-NEXT: mffsl 1
157 %x = call double @llvm.ppc.mffsl()
161 declare void @effect_func()
162 declare void @readonly_func() #1
163 declare double @llvm.ppc.mffsl()
164 declare double @llvm.ppc.readflm()
165 declare double @llvm.ppc.setflm(double)
166 declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
167 declare double @llvm.experimental.constrained.fdiv.f64(double, double, metadata, metadata)
169 attributes #0 = { strictfp }
170 attributes #1 = { readonly }