1 ; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- -fp-contract=fast -mattr=-vsx -disable-ppc-vsx-fma-mutation=false | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -fp-contract=fast -mattr=+vsx -mcpu=pwr7 -disable-ppc-vsx-fma-mutation=false | FileCheck -check-prefix=CHECK-VSX %s
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -fp-contract=fast -mcpu=pwr8 -disable-ppc-vsx-fma-mutation=false | FileCheck -check-prefix=CHECK-P8 %s
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -fp-contract=fast -mcpu=pwr8 -disable-ppc-vsx-fma-mutation=false | FileCheck -check-prefix=CHECK-P8 %s
6 declare double @dummy1(double) #0
7 declare double @dummy2(double, double) #0
8 declare double @dummy3(double, double, double) #0
9 declare float @dummy4(float, float) #0
11 define double @test_FMADD1(double %A, double %B, double %C) {
12 %D = fmul double %A, %B ; <double> [#uses=1]
13 %E = fadd double %C, %D ; <double> [#uses=1]
15 ; CHECK-LABEL: test_FMADD1:
19 ; CHECK-VSX-LABEL: test_FMADD1:
20 ; CHECK-VSX: xsmaddmdp
24 define double @test_FMADD2(double %A, double %B, double %C) {
25 %D = fmul double %A, %B ; <double> [#uses=1]
26 %E = fadd double %D, %C ; <double> [#uses=1]
28 ; CHECK-LABEL: test_FMADD2:
32 ; CHECK-VSX-LABEL: test_FMADD2:
33 ; CHECK-VSX: xsmaddmdp
37 define double @test_FMSUB1(double %A, double %B, double %C) {
38 %D = fmul double %A, %B ; <double> [#uses=1]
39 %E = fsub double %D, %C ; <double> [#uses=1]
41 ; CHECK-LABEL: test_FMSUB1:
45 ; CHECK-VSX-LABEL: test_FMSUB1:
46 ; CHECK-VSX: xsmsubmdp
50 define double @test_FMSUB2(double %A, double %B, double %C, double %D) {
51 %E = fmul double %A, %B ; <double> [#uses=2]
52 %F = fadd double %E, %C ; <double> [#uses=1]
53 %G = fsub double %E, %D ; <double> [#uses=1]
54 %H = call double @dummy2(double %F, double %G) ; <double> [#uses=1]
56 ; CHECK-LABEL: test_FMSUB2:
60 ; CHECK-VSX-LABEL: test_FMSUB2:
61 ; CHECK-VSX: xsmaddadp
62 ; CHECK-VSX-NEXT: xsmsubmdp
65 define double @test_FNMADD1(double %A, double %B, double %C) {
66 %D = fmul double %A, %B ; <double> [#uses=1]
67 %E = fadd double %D, %C ; <double> [#uses=1]
68 %F = fsub double -0.000000e+00, %E ; <double> [#uses=1]
70 ; CHECK-LABEL: test_FNMADD1:
74 ; CHECK-VSX-LABEL: test_FNMADD1:
75 ; CHECK-VSX: xsnmaddmdp
79 define double @test_FNMADD2(double %A, double %B, double %C) {
80 %D = fmul double %A, %B ; <double> [#uses=1]
81 %E = fadd double %C, %D ; <double> [#uses=1]
82 %F = fsub double -0.000000e+00, %E ; <double> [#uses=1]
84 ; CHECK-LABEL: test_FNMADD2:
88 ; CHECK-VSX-LABEL: test_FNMADD2:
89 ; CHECK-VSX: xsnmaddmdp
93 define double @test_FNMSUB1(double %A, double %B, double %C) {
94 %D = fmul double %A, %B ; <double> [#uses=1]
95 %E = fsub double %C, %D ; <double> [#uses=1]
97 ; CHECK-LABEL: test_FNMSUB1:
101 ; CHECK-VSX-LABEL: test_FNMSUB1:
102 ; CHECK-VSX: xsnmsubmdp
105 define double @test_FNMSUB2(double %A, double %B, double %C) {
106 %D = fmul double %A, %B ; <double> [#uses=1]
107 %E = fsub double %D, %C ; <double> [#uses=1]
108 %F = fsub double -0.000000e+00, %E ; <double> [#uses=1]
110 ; CHECK-LABEL: test_FNMSUB2:
114 ; CHECK-VSX-LABEL: test_FNMSUB2:
115 ; CHECK-VSX: xsnmsubmdp
116 ; CHECK-VSX-NEXT: blr
119 define float @test_FNMSUBS(float %A, float %B, float %C) {
120 %D = fmul float %A, %B ; <float> [#uses=1]
121 %E = fsub float %D, %C ; <float> [#uses=1]
122 %F = fsub float -0.000000e+00, %E ; <float> [#uses=1]
124 ; CHECK-LABEL: test_FNMSUBS:
128 ; CHECK-VSX-LABEL: test_FNMSUBS:
130 ; CHECK-VSX-NEXT: blr
133 define float @test_XSMADDMSP(float %A, float %B, float %C) {
134 %D = fmul float %A, %B ; <float> [#uses=1]
135 %E = fadd float %C, %D ; <float> [#uses=1]
137 ; CHECK-P8-LABEL: test_XSMADDMSP:
138 ; CHECK-P8: xsmaddmsp
142 define float @test_XSMSUBMSP(float %A, float %B, float %C) {
143 %D = fmul float %A, %B ; <float> [#uses=1]
144 %E = fsub float %D, %C ; <float> [#uses=1]
146 ; CHECK-P8-LABEL: test_XSMSUBMSP:
147 ; CHECK-P8: xsmsubmsp
151 define float @test_XSMADDASP(float %A, float %B, float %C, float %D) {
152 %E = fmul float %A, %B ; <float> [#uses=2]
153 %F = fadd float %E, %C ; <float> [#uses=1]
154 %G = fsub float %E, %D ; <float> [#uses=1]
155 %H = call float @dummy4(float %F, float %G) ; <float> [#uses=1]
157 ; CHECK-P8-LABEL: test_XSMADDASP:
158 ; CHECK-P8: xsmaddasp
159 ; CHECK-P8-NEXT: xsmsubmsp
162 define float @test_XSMSUBASP(float %A, float %B, float %C, float %D) {
163 %E = fmul float %A, %B ; <float> [#uses=2]
164 %F = fsub float %E, %C ; <float> [#uses=1]
165 %G = fsub float %E, %D ; <float> [#uses=1]
166 %H = call float @dummy4(float %F, float %G) ; <float> [#uses=1]
168 ; CHECK-P8-LABEL: test_XSMSUBASP:
169 ; CHECK-P8: xsmsubasp
170 ; CHECK-P8-NEXT: xsmsubmsp
173 define float @test_XSNMADDMSP(float %A, float %B, float %C) {
174 %D = fmul float %A, %B ; <float> [#uses=1]
175 %E = fadd float %D, %C ; <float> [#uses=1]
176 %F = fsub float -0.000000e+00, %E ; <float> [#uses=1]
178 ; CHECK-P8-LABEL: test_XSNMADDMSP:
179 ; CHECK-P8: xsnmaddmsp
183 define float @test_XSNMSUBMSP(float %A, float %B, float %C) {
184 %D = fmul float %A, %B ; <float> [#uses=1]
185 %E = fsub float %D, %C ; <float> [#uses=1]
186 %F = fsub float -0.000000e+00, %E ; <float> [#uses=1]
188 ; CHECK-P8-LABEL: test_XSNMSUBMSP:
189 ; CHECK-P8: xsnmsubmsp
193 define float @test_XSNMADDASP(float %A, float %B, float %C) {
194 %D = fmul float %A, %B ; <float> [#uses=1]
195 %E = fadd float %D, %C ; <float> [#uses=1]
196 %F = fsub float -0.000000e+00, %E ; <float> [#uses=1]
197 %H = call float @dummy4(float %E, float %F) ; <float> [#uses=1]
199 ; CHECK-P8-LABEL: test_XSNMADDASP:
200 ; CHECK-P8: xsnmaddasp
203 define float @test_XSNMSUBASP(float %A, float %B, float %C) {
204 %D = fmul float %A, %B ; <float> [#uses=1]
205 %E = fsub float %D, %C ; <float> [#uses=1]
206 %F = fsub float -0.000000e+00, %E ; <float> [#uses=1]
207 %H = call float @dummy4(float %E, float %F) ; <float> [#uses=1]
209 ; CHECK-P8-LABEL: test_XSNMSUBASP:
210 ; CHECK-P8: xsnmsubasp