11
11
; a / D; b / D; c / D;
12
12
; =>
13
13
; recip = 1.0 / D; a * recip; b * recip; c * recip;
14
- define void @three_fdiv_float (float %D , float %a , float %b , float %c ) # 0 {
14
+ define void @three_fdiv_float (float %D , float %a , float %b , float %c ) {
15
15
; CHECK-SD-LABEL: three_fdiv_float:
16
16
; CHECK-SD: // %bb.0:
17
17
; CHECK-SD-NEXT: fmov s4, #1.00000000
@@ -28,14 +28,14 @@ define void @three_fdiv_float(float %D, float %a, float %b, float %c) #0 {
28
28
; CHECK-GI-NEXT: fdiv s2, s3, s0
29
29
; CHECK-GI-NEXT: fmov s0, s4
30
30
; CHECK-GI-NEXT: b foo_3f
31
- %div = fdiv float %a , %D
32
- %div1 = fdiv float %b , %D
33
- %div2 = fdiv float %c , %D
31
+ %div = fdiv arcp float %a , %D
32
+ %div1 = fdiv arcp float %b , %D
33
+ %div2 = fdiv arcp float %c , %D
34
34
tail call void @foo_3f (float %div , float %div1 , float %div2 )
35
35
ret void
36
36
}
37
37
38
- define void @three_fdiv_double (double %D , double %a , double %b , double %c ) # 0 {
38
+ define void @three_fdiv_double (double %D , double %a , double %b , double %c ) {
39
39
; CHECK-SD-LABEL: three_fdiv_double:
40
40
; CHECK-SD: // %bb.0:
41
41
; CHECK-SD-NEXT: fmov d4, #1.00000000
@@ -52,14 +52,14 @@ define void @three_fdiv_double(double %D, double %a, double %b, double %c) #0 {
52
52
; CHECK-GI-NEXT: fdiv d2, d3, d0
53
53
; CHECK-GI-NEXT: fmov d0, d4
54
54
; CHECK-GI-NEXT: b foo_3d
55
- %div = fdiv double %a , %D
56
- %div1 = fdiv double %b , %D
57
- %div2 = fdiv double %c , %D
55
+ %div = fdiv arcp double %a , %D
56
+ %div1 = fdiv arcp double %b , %D
57
+ %div2 = fdiv arcp double %c , %D
58
58
tail call void @foo_3d (double %div , double %div1 , double %div2 )
59
59
ret void
60
60
}
61
61
62
- define void @three_fdiv_4xfloat (<4 x float > %D , <4 x float > %a , <4 x float > %b , <4 x float > %c ) # 0 {
62
+ define void @three_fdiv_4xfloat (<4 x float > %D , <4 x float > %a , <4 x float > %b , <4 x float > %c ) {
63
63
; CHECK-SD-LABEL: three_fdiv_4xfloat:
64
64
; CHECK-SD: // %bb.0:
65
65
; CHECK-SD-NEXT: fmov v4.4s, #1.00000000
@@ -76,14 +76,14 @@ define void @three_fdiv_4xfloat(<4 x float> %D, <4 x float> %a, <4 x float> %b,
76
76
; CHECK-GI-NEXT: fdiv v2.4s, v3.4s, v0.4s
77
77
; CHECK-GI-NEXT: mov v0.16b, v4.16b
78
78
; CHECK-GI-NEXT: b foo_3_4xf
79
- %div = fdiv <4 x float > %a , %D
80
- %div1 = fdiv <4 x float > %b , %D
81
- %div2 = fdiv <4 x float > %c , %D
79
+ %div = fdiv arcp <4 x float > %a , %D
80
+ %div1 = fdiv arcp <4 x float > %b , %D
81
+ %div2 = fdiv arcp <4 x float > %c , %D
82
82
tail call void @foo_3_4xf (<4 x float > %div , <4 x float > %div1 , <4 x float > %div2 )
83
83
ret void
84
84
}
85
85
86
- define void @three_fdiv_2xdouble (<2 x double > %D , <2 x double > %a , <2 x double > %b , <2 x double > %c ) # 0 {
86
+ define void @three_fdiv_2xdouble (<2 x double > %D , <2 x double > %a , <2 x double > %b , <2 x double > %c ) {
87
87
; CHECK-SD-LABEL: three_fdiv_2xdouble:
88
88
; CHECK-SD: // %bb.0:
89
89
; CHECK-SD-NEXT: fmov v4.2d, #1.00000000
@@ -100,42 +100,42 @@ define void @three_fdiv_2xdouble(<2 x double> %D, <2 x double> %a, <2 x double>
100
100
; CHECK-GI-NEXT: fdiv v2.2d, v3.2d, v0.2d
101
101
; CHECK-GI-NEXT: mov v0.16b, v4.16b
102
102
; CHECK-GI-NEXT: b foo_3_2xd
103
- %div = fdiv <2 x double > %a , %D
104
- %div1 = fdiv <2 x double > %b , %D
105
- %div2 = fdiv <2 x double > %c , %D
103
+ %div = fdiv arcp <2 x double > %a , %D
104
+ %div1 = fdiv arcp <2 x double > %b , %D
105
+ %div2 = fdiv arcp <2 x double > %c , %D
106
106
tail call void @foo_3_2xd (<2 x double > %div , <2 x double > %div1 , <2 x double > %div2 )
107
107
ret void
108
108
}
109
109
110
110
; Following test cases check we never combine two FDIVs if neither of them
111
111
; calculates a reciprocal.
112
- define void @two_fdiv_float (float %D , float %a , float %b ) # 0 {
112
+ define void @two_fdiv_float (float %D , float %a , float %b ) {
113
113
; CHECK-LABEL: two_fdiv_float:
114
114
; CHECK: // %bb.0:
115
115
; CHECK-NEXT: fdiv s3, s1, s0
116
116
; CHECK-NEXT: fdiv s1, s2, s0
117
117
; CHECK-NEXT: fmov s0, s3
118
118
; CHECK-NEXT: b foo_2f
119
- %div = fdiv float %a , %D
120
- %div1 = fdiv float %b , %D
119
+ %div = fdiv arcp float %a , %D
120
+ %div1 = fdiv arcp float %b , %D
121
121
tail call void @foo_2f (float %div , float %div1 )
122
122
ret void
123
123
}
124
124
125
- define void @two_fdiv_double (double %D , double %a , double %b ) # 0 {
125
+ define void @two_fdiv_double (double %D , double %a , double %b ) {
126
126
; CHECK-LABEL: two_fdiv_double:
127
127
; CHECK: // %bb.0:
128
128
; CHECK-NEXT: fdiv d3, d1, d0
129
129
; CHECK-NEXT: fdiv d1, d2, d0
130
130
; CHECK-NEXT: fmov d0, d3
131
131
; CHECK-NEXT: b foo_2d
132
- %div = fdiv double %a , %D
133
- %div1 = fdiv double %b , %D
132
+ %div = fdiv arcp double %a , %D
133
+ %div1 = fdiv arcp double %b , %D
134
134
tail call void @foo_2d (double %div , double %div1 )
135
135
ret void
136
136
}
137
137
138
- define void @splat_three_fdiv_4xfloat (float %D , <4 x float > %a , <4 x float > %b , <4 x float > %c ) # 0 {
138
+ define void @splat_three_fdiv_4xfloat (float %D , <4 x float > %a , <4 x float > %b , <4 x float > %c ) {
139
139
; CHECK-SD-LABEL: splat_three_fdiv_4xfloat:
140
140
; CHECK-SD: // %bb.0:
141
141
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
@@ -157,14 +157,14 @@ define void @splat_three_fdiv_4xfloat(float %D, <4 x float> %a, <4 x float> %b,
157
157
; CHECK-GI-NEXT: b foo_3_4xf
158
158
%D.ins = insertelement <4 x float > poison, float %D , i64 0
159
159
%splat = shufflevector <4 x float > %D.ins , <4 x float > poison, <4 x i32 > zeroinitializer
160
- %div = fdiv <4 x float > %a , %splat
161
- %div1 = fdiv <4 x float > %b , %splat
162
- %div2 = fdiv <4 x float > %c , %splat
160
+ %div = fdiv arcp <4 x float > %a , %splat
161
+ %div1 = fdiv arcp <4 x float > %b , %splat
162
+ %div2 = fdiv arcp <4 x float > %c , %splat
163
163
tail call void @foo_3_4xf (<4 x float > %div , <4 x float > %div1 , <4 x float > %div2 )
164
164
ret void
165
165
}
166
166
167
- define <4 x float > @splat_fdiv_v4f32 (float %D , <4 x float > %a ) #1 {
167
+ define <4 x float > @splat_fdiv_v4f32 (float %D , <4 x float > %a ) #0 {
168
168
; CHECK-SD-LABEL: splat_fdiv_v4f32:
169
169
; CHECK-SD: // %bb.0: // %entry
170
170
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
@@ -183,11 +183,11 @@ define <4 x float> @splat_fdiv_v4f32(float %D, <4 x float> %a) #1 {
183
183
entry:
184
184
%D.ins = insertelement <4 x float > poison, float %D , i64 0
185
185
%splat = shufflevector <4 x float > %D.ins , <4 x float > poison, <4 x i32 > zeroinitializer
186
- %div = fdiv <4 x float > %a , %splat
186
+ %div = fdiv arcp <4 x float > %a , %splat
187
187
ret <4 x float > %div
188
188
}
189
189
190
- define <vscale x 4 x float > @splat_fdiv_nxv4f32 (float %D , <vscale x 4 x float > %a ) #1 {
190
+ define <vscale x 4 x float > @splat_fdiv_nxv4f32 (float %D , <vscale x 4 x float > %a ) #0 {
191
191
; CHECK-LABEL: splat_fdiv_nxv4f32:
192
192
; CHECK: // %bb.0: // %entry
193
193
; CHECK-NEXT: fmov s2, #1.00000000
@@ -198,11 +198,11 @@ define <vscale x 4 x float> @splat_fdiv_nxv4f32(float %D, <vscale x 4 x float> %
198
198
entry:
199
199
%D.ins = insertelement <vscale x 4 x float > poison, float %D , i64 0
200
200
%splat = shufflevector <vscale x 4 x float > %D.ins , <vscale x 4 x float > poison, <vscale x 4 x i32 > zeroinitializer
201
- %div = fdiv <vscale x 4 x float > %a , %splat
201
+ %div = fdiv arcp <vscale x 4 x float > %a , %splat
202
202
ret <vscale x 4 x float > %div
203
203
}
204
204
205
- define void @splat_three_fdiv_nxv4f32 (float %D , <vscale x 4 x float > %a , <vscale x 4 x float > %b , <vscale x 4 x float > %c ) #1 {
205
+ define void @splat_three_fdiv_nxv4f32 (float %D , <vscale x 4 x float > %a , <vscale x 4 x float > %b , <vscale x 4 x float > %c ) #0 {
206
206
; CHECK-LABEL: splat_three_fdiv_nxv4f32:
207
207
; CHECK: // %bb.0: // %entry
208
208
; CHECK-NEXT: fmov s4, #1.00000000
@@ -215,14 +215,14 @@ define void @splat_three_fdiv_nxv4f32(float %D, <vscale x 4 x float> %a, <vscale
215
215
entry:
216
216
%D.ins = insertelement <vscale x 4 x float > poison, float %D , i64 0
217
217
%splat = shufflevector <vscale x 4 x float > %D.ins , <vscale x 4 x float > poison, <vscale x 4 x i32 > zeroinitializer
218
- %div = fdiv <vscale x 4 x float > %a , %splat
219
- %div1 = fdiv <vscale x 4 x float > %b , %splat
220
- %div2 = fdiv <vscale x 4 x float > %c , %splat
218
+ %div = fdiv arcp <vscale x 4 x float > %a , %splat
219
+ %div1 = fdiv arcp <vscale x 4 x float > %b , %splat
220
+ %div2 = fdiv arcp <vscale x 4 x float > %c , %splat
221
221
tail call void @foo_3_nxv4f32 (<vscale x 4 x float > %div , <vscale x 4 x float > %div1 , <vscale x 4 x float > %div2 )
222
222
ret void
223
223
}
224
224
225
- define <vscale x 2 x double > @splat_fdiv_nxv2f64 (double %D , <vscale x 2 x double > %a ) #1 {
225
+ define <vscale x 2 x double > @splat_fdiv_nxv2f64 (double %D , <vscale x 2 x double > %a ) #0 {
226
226
; CHECK-LABEL: splat_fdiv_nxv2f64:
227
227
; CHECK: // %bb.0: // %entry
228
228
; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
@@ -237,7 +237,7 @@ entry:
237
237
ret <vscale x 2 x double > %div
238
238
}
239
239
240
- define void @splat_two_fdiv_nxv2f64 (double %D , <vscale x 2 x double > %a , <vscale x 2 x double > %b ) #1 {
240
+ define void @splat_two_fdiv_nxv2f64 (double %D , <vscale x 2 x double > %a , <vscale x 2 x double > %b ) #0 {
241
241
; CHECK-LABEL: splat_two_fdiv_nxv2f64:
242
242
; CHECK: // %bb.0: // %entry
243
243
; CHECK-NEXT: fmov d3, #1.00000000
@@ -249,8 +249,8 @@ define void @splat_two_fdiv_nxv2f64(double %D, <vscale x 2 x double> %a, <vscale
249
249
entry:
250
250
%D.ins = insertelement <vscale x 2 x double > poison, double %D , i64 0
251
251
%splat = shufflevector <vscale x 2 x double > %D.ins , <vscale x 2 x double > poison, <vscale x 2 x i32 > zeroinitializer
252
- %div = fdiv <vscale x 2 x double > %a , %splat
253
- %div1 = fdiv <vscale x 2 x double > %b , %splat
252
+ %div = fdiv arcp <vscale x 2 x double > %a , %splat
253
+ %div1 = fdiv arcp <vscale x 2 x double > %b , %splat
254
254
tail call void @foo_2_nxv2f64 (<vscale x 2 x double > %div , <vscale x 2 x double > %div1 )
255
255
ret void
256
256
}
@@ -264,5 +264,4 @@ declare void @foo_2d(double, double)
264
264
declare void @foo_3_nxv4f32 (<vscale x 4 x float >, <vscale x 4 x float >, <vscale x 4 x float >)
265
265
declare void @foo_2_nxv2f64 (<vscale x 2 x double >, <vscale x 2 x double >)
266
266
267
- attributes #0 = { "unsafe-fp-math" ="true" }
268
- attributes #1 = { "unsafe-fp-math" ="true" "target-features" ="+sve" }
267
+ attributes #0 = { "target-features" ="+sve" }
0 commit comments