llvm.org GIT mirror llvm / stable test / CodeGen / AArch64 / sqrt-fastmath.ll
stable

Tree @stable (Download .tar.gz)

sqrt-fastmath.ll @stableraw · history · blame

  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
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -mattr=+neon,-use-reciprocal-square-root | FileCheck %s --check-prefix=FAULT
; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -mattr=+neon,+use-reciprocal-square-root | FileCheck %s

declare float @llvm.sqrt.f32(float) #0
declare <2 x float> @llvm.sqrt.v2f32(<2 x float>) #0
declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #0
declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #0
declare double @llvm.sqrt.f64(double) #0
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #0
declare <4 x double> @llvm.sqrt.v4f64(<4 x double>) #0

define float @fsqrt(float %a) #0 {
; FAULT-LABEL: fsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt s0, s0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: fsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte s1, s0
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s2, s0, s2
; CHECK-NEXT:    fmul s1, s1, s2
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s2, s0, s2
; CHECK-NEXT:    fmul s2, s2, s0
; CHECK-NEXT:    fmul s1, s1, s2
; CHECK-NEXT:    fcmp s0, #0.0
; CHECK-NEXT:    fcsel s0, s0, s1, eq
; CHECK-NEXT:    ret
  %1 = tail call fast float @llvm.sqrt.f32(float %a)
  ret float %1
}

define float @fsqrt_ieee_denorms(float %a) #1 {
; FAULT-LABEL: fsqrt_ieee_denorms:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt s0, s0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: fsqrt_ieee_denorms:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte s1, s0
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s2, s0, s2
; CHECK-NEXT:    fmul s1, s1, s2
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s2, s0, s2
; CHECK-NEXT:    fmul s2, s2, s0
; CHECK-NEXT:    fmul s1, s1, s2
; CHECK-NEXT:    fcmp s0, #0.0
; CHECK-NEXT:    fcsel s0, s0, s1, eq
; CHECK-NEXT:    ret
  %1 = tail call fast float @llvm.sqrt.f32(float %a)
  ret float %1
}

define <2 x float> @f2sqrt(<2 x float> %a) #0 {
; FAULT-LABEL: f2sqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.2s, v0.2s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f2sqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.2s, v0.2s
; CHECK-NEXT:    fmul v2.2s, v1.2s, v1.2s
; CHECK-NEXT:    frsqrts v2.2s, v0.2s, v2.2s
; CHECK-NEXT:    fmul v1.2s, v1.2s, v2.2s
; CHECK-NEXT:    fmul v2.2s, v1.2s, v1.2s
; CHECK-NEXT:    frsqrts v2.2s, v0.2s, v2.2s
; CHECK-NEXT:    fmul v2.2s, v2.2s, v0.2s
; CHECK-NEXT:    fmul v2.2s, v1.2s, v2.2s
; CHECK-NEXT:    fcmeq v1.2s, v0.2s, #0.0
; CHECK-NEXT:    bsl v1.8b, v0.8b, v2.8b
; CHECK-NEXT:    mov v0.16b, v1.16b
; CHECK-NEXT:    ret
  %1 = tail call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> %a)
  ret <2 x float> %1
}

define <4 x float> @f4sqrt(<4 x float> %a) #0 {
; FAULT-LABEL: f4sqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.4s, v0.4s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f4sqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.4s, v0.4s
; CHECK-NEXT:    fmul v2.4s, v1.4s, v1.4s
; CHECK-NEXT:    frsqrts v2.4s, v0.4s, v2.4s
; CHECK-NEXT:    fmul v1.4s, v1.4s, v2.4s
; CHECK-NEXT:    fmul v2.4s, v1.4s, v1.4s
; CHECK-NEXT:    frsqrts v2.4s, v0.4s, v2.4s
; CHECK-NEXT:    fmul v2.4s, v2.4s, v0.4s
; CHECK-NEXT:    fmul v2.4s, v1.4s, v2.4s
; CHECK-NEXT:    fcmeq v1.4s, v0.4s, #0.0
; CHECK-NEXT:    bsl v1.16b, v0.16b, v2.16b
; CHECK-NEXT:    mov v0.16b, v1.16b
; CHECK-NEXT:    ret
  %1 = tail call fast <4 x float> @llvm.sqrt.v4f32(<4 x float> %a)
  ret <4 x float> %1
}

define <8 x float> @f8sqrt(<8 x float> %a) #0 {
; FAULT-LABEL: f8sqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.4s, v0.4s
; FAULT-NEXT:    fsqrt v1.4s, v1.4s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f8sqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v2.4s, v0.4s
; CHECK-NEXT:    fmul v3.4s, v2.4s, v2.4s
; CHECK-NEXT:    frsqrts v3.4s, v0.4s, v3.4s
; CHECK-NEXT:    fmul v2.4s, v2.4s, v3.4s
; CHECK-NEXT:    fmul v3.4s, v2.4s, v2.4s
; CHECK-NEXT:    frsqrts v3.4s, v0.4s, v3.4s
; CHECK-NEXT:    fmul v3.4s, v3.4s, v0.4s
; CHECK-NEXT:    fmul v3.4s, v2.4s, v3.4s
; CHECK-NEXT:    fcmeq v2.4s, v0.4s, #0.0
; CHECK-NEXT:    bsl v2.16b, v0.16b, v3.16b
; CHECK-NEXT:    frsqrte v0.4s, v1.4s
; CHECK-NEXT:    fmul v3.4s, v0.4s, v0.4s
; CHECK-NEXT:    frsqrts v3.4s, v1.4s, v3.4s
; CHECK-NEXT:    fmul v0.4s, v0.4s, v3.4s
; CHECK-NEXT:    fmul v3.4s, v0.4s, v0.4s
; CHECK-NEXT:    frsqrts v3.4s, v1.4s, v3.4s
; CHECK-NEXT:    fmul v3.4s, v3.4s, v1.4s
; CHECK-NEXT:    fmul v0.4s, v0.4s, v3.4s
; CHECK-NEXT:    fcmeq v3.4s, v1.4s, #0.0
; CHECK-NEXT:    bsl v3.16b, v1.16b, v0.16b
; CHECK-NEXT:    mov v0.16b, v2.16b
; CHECK-NEXT:    mov v1.16b, v3.16b
; CHECK-NEXT:    ret
  %1 = tail call fast <8 x float> @llvm.sqrt.v8f32(<8 x float> %a)
  ret <8 x float> %1
}

define double @dsqrt(double %a) #0 {
; FAULT-LABEL: dsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt d0, d0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: dsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte d1, d0
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d2, d2, d0
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fcmp d0, #0.0
; CHECK-NEXT:    fcsel d0, d0, d1, eq
; CHECK-NEXT:    ret
  %1 = tail call fast double @llvm.sqrt.f64(double %a)
  ret double %1
}

define double @dsqrt_ieee_denorms(double %a) #1 {
; FAULT-LABEL: dsqrt_ieee_denorms:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt d0, d0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: dsqrt_ieee_denorms:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte d1, d0
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d2, d2, d0
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fcmp d0, #0.0
; CHECK-NEXT:    fcsel d0, d0, d1, eq
; CHECK-NEXT:    ret
  %1 = tail call fast double @llvm.sqrt.f64(double %a)
  ret double %1
}

define <2 x double> @d2sqrt(<2 x double> %a) #0 {
; FAULT-LABEL: d2sqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.2d, v0.2d
; FAULT-NEXT:    ret
;
; CHECK-LABEL: d2sqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.2d, v0.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v2.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v1.2d, v1.2d, v2.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v2.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v1.2d, v1.2d, v2.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v2.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v2.2d, v2.2d, v0.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v2.2d
; CHECK-NEXT:    fcmeq v1.2d, v0.2d, #0.0
; CHECK-NEXT:    bsl v1.16b, v0.16b, v2.16b
; CHECK-NEXT:    mov v0.16b, v1.16b
; CHECK-NEXT:    ret
  %1 = tail call fast <2 x double> @llvm.sqrt.v2f64(<2 x double> %a)
  ret <2 x double> %1
}

define <4 x double> @d4sqrt(<4 x double> %a) #0 {
; FAULT-LABEL: d4sqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.2d, v0.2d
; FAULT-NEXT:    fsqrt v1.2d, v1.2d
; FAULT-NEXT:    ret
;
; CHECK-LABEL: d4sqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v2.2d, v0.2d
; CHECK-NEXT:    fmul v3.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrts v3.2d, v0.2d, v3.2d
; CHECK-NEXT:    fmul v2.2d, v2.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrts v3.2d, v0.2d, v3.2d
; CHECK-NEXT:    fmul v2.2d, v2.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrts v3.2d, v0.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v3.2d, v0.2d
; CHECK-NEXT:    fmul v3.2d, v2.2d, v3.2d
; CHECK-NEXT:    fcmeq v2.2d, v0.2d, #0.0
; CHECK-NEXT:    bsl v2.16b, v0.16b, v3.16b
; CHECK-NEXT:    frsqrte v0.2d, v1.2d
; CHECK-NEXT:    fmul v3.2d, v0.2d, v0.2d
; CHECK-NEXT:    frsqrts v3.2d, v1.2d, v3.2d
; CHECK-NEXT:    fmul v0.2d, v0.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v0.2d, v0.2d
; CHECK-NEXT:    frsqrts v3.2d, v1.2d, v3.2d
; CHECK-NEXT:    fmul v0.2d, v0.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v0.2d, v0.2d
; CHECK-NEXT:    frsqrts v3.2d, v1.2d, v3.2d
; CHECK-NEXT:    fmul v3.2d, v3.2d, v1.2d
; CHECK-NEXT:    fmul v0.2d, v0.2d, v3.2d
; CHECK-NEXT:    fcmeq v3.2d, v1.2d, #0.0
; CHECK-NEXT:    bsl v3.16b, v1.16b, v0.16b
; CHECK-NEXT:    mov v0.16b, v2.16b
; CHECK-NEXT:    mov v1.16b, v3.16b
; CHECK-NEXT:    ret
  %1 = tail call fast <4 x double> @llvm.sqrt.v4f64(<4 x double> %a)
  ret <4 x double> %1
}

define float @frsqrt(float %a) #0 {
; FAULT-LABEL: frsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt s0, s0
; FAULT-NEXT:    fmov s1, #1.00000000
; FAULT-NEXT:    fdiv s0, s1, s0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: frsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte s1, s0
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s2, s0, s2
; CHECK-NEXT:    fmul s1, s1, s2
; CHECK-NEXT:    fmul s2, s1, s1
; CHECK-NEXT:    frsqrts s0, s0, s2
; CHECK-NEXT:    fmul s0, s1, s0
; CHECK-NEXT:    ret
  %1 = tail call fast float @llvm.sqrt.f32(float %a)
  %2 = fdiv fast float 1.000000e+00, %1
  ret float %2
}

define <2 x float> @f2rsqrt(<2 x float> %a) #0 {
; FAULT-LABEL: f2rsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.2s, v0.2s
; FAULT-NEXT:    fmov v1.2s, #1.00000000
; FAULT-NEXT:    fdiv v0.2s, v1.2s, v0.2s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f2rsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.2s, v0.2s
; CHECK-NEXT:    fmul v2.2s, v1.2s, v1.2s
; CHECK-NEXT:    frsqrts v2.2s, v0.2s, v2.2s
; CHECK-NEXT:    fmul v1.2s, v1.2s, v2.2s
; CHECK-NEXT:    fmul v2.2s, v1.2s, v1.2s
; CHECK-NEXT:    frsqrts v0.2s, v0.2s, v2.2s
; CHECK-NEXT:    fmul v0.2s, v1.2s, v0.2s
; CHECK-NEXT:    ret
  %1 = tail call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> %a)
  %2 = fdiv fast <2 x float> <float 1.000000e+00, float 1.000000e+00>, %1
  ret <2 x float> %2
}

define <4 x float> @f4rsqrt(<4 x float> %a) #0 {
; FAULT-LABEL: f4rsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.4s, v0.4s
; FAULT-NEXT:    fmov v1.4s, #1.00000000
; FAULT-NEXT:    fdiv v0.4s, v1.4s, v0.4s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f4rsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.4s, v0.4s
; CHECK-NEXT:    fmul v2.4s, v1.4s, v1.4s
; CHECK-NEXT:    frsqrts v2.4s, v0.4s, v2.4s
; CHECK-NEXT:    fmul v1.4s, v1.4s, v2.4s
; CHECK-NEXT:    fmul v2.4s, v1.4s, v1.4s
; CHECK-NEXT:    frsqrts v0.4s, v0.4s, v2.4s
; CHECK-NEXT:    fmul v0.4s, v1.4s, v0.4s
; CHECK-NEXT:    ret
  %1 = tail call fast <4 x float> @llvm.sqrt.v4f32(<4 x float> %a)
  %2 = fdiv fast <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, %1
  ret <4 x float> %2
}

define <8 x float> @f8rsqrt(<8 x float> %a) #0 {
; FAULT-LABEL: f8rsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v1.4s, v1.4s
; FAULT-NEXT:    fsqrt v0.4s, v0.4s
; FAULT-NEXT:    fmov v2.4s, #1.00000000
; FAULT-NEXT:    fdiv v0.4s, v2.4s, v0.4s
; FAULT-NEXT:    fdiv v1.4s, v2.4s, v1.4s
; FAULT-NEXT:    ret
;
; CHECK-LABEL: f8rsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v2.4s, v0.4s
; CHECK-NEXT:    fmul v4.4s, v2.4s, v2.4s
; CHECK-NEXT:    frsqrte v3.4s, v1.4s
; CHECK-NEXT:    frsqrts v4.4s, v0.4s, v4.4s
; CHECK-NEXT:    fmul v2.4s, v2.4s, v4.4s
; CHECK-NEXT:    fmul v4.4s, v3.4s, v3.4s
; CHECK-NEXT:    frsqrts v4.4s, v1.4s, v4.4s
; CHECK-NEXT:    fmul v3.4s, v3.4s, v4.4s
; CHECK-NEXT:    fmul v4.4s, v2.4s, v2.4s
; CHECK-NEXT:    frsqrts v0.4s, v0.4s, v4.4s
; CHECK-NEXT:    fmul v4.4s, v3.4s, v3.4s
; CHECK-NEXT:    frsqrts v1.4s, v1.4s, v4.4s
; CHECK-NEXT:    fmul v0.4s, v2.4s, v0.4s
; CHECK-NEXT:    fmul v1.4s, v3.4s, v1.4s
; CHECK-NEXT:    ret
  %1 = tail call fast <8 x float> @llvm.sqrt.v8f32(<8 x float> %a)
  %2 = fdiv fast <8 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, %1
  ret <8 x float> %2
}

define double @drsqrt(double %a) #0 {
; FAULT-LABEL: drsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt d0, d0
; FAULT-NEXT:    fmov d1, #1.00000000
; FAULT-NEXT:    fdiv d0, d1, d0
; FAULT-NEXT:    ret
;
; CHECK-LABEL: drsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte d1, d0
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d2, d0, d2
; CHECK-NEXT:    fmul d1, d1, d2
; CHECK-NEXT:    fmul d2, d1, d1
; CHECK-NEXT:    frsqrts d0, d0, d2
; CHECK-NEXT:    fmul d0, d1, d0
; CHECK-NEXT:    ret
  %1 = tail call fast double @llvm.sqrt.f64(double %a)
  %2 = fdiv fast double 1.000000e+00, %1
  ret double %2
}

define <2 x double> @d2rsqrt(<2 x double> %a) #0 {
; FAULT-LABEL: d2rsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v0.2d, v0.2d
; FAULT-NEXT:    fmov v1.2d, #1.00000000
; FAULT-NEXT:    fdiv v0.2d, v1.2d, v0.2d
; FAULT-NEXT:    ret
;
; CHECK-LABEL: d2rsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v1.2d, v0.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v2.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v1.2d, v1.2d, v2.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v2.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v1.2d, v1.2d, v2.2d
; CHECK-NEXT:    fmul v2.2d, v1.2d, v1.2d
; CHECK-NEXT:    frsqrts v0.2d, v0.2d, v2.2d
; CHECK-NEXT:    fmul v0.2d, v1.2d, v0.2d
; CHECK-NEXT:    ret
  %1 = tail call fast <2 x double> @llvm.sqrt.v2f64(<2 x double> %a)
  %2 = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, %1
  ret <2 x double> %2
}

define <4 x double> @d4rsqrt(<4 x double> %a) #0 {
; FAULT-LABEL: d4rsqrt:
; FAULT:       // %bb.0:
; FAULT-NEXT:    fsqrt v1.2d, v1.2d
; FAULT-NEXT:    fsqrt v0.2d, v0.2d
; FAULT-NEXT:    fmov v2.2d, #1.00000000
; FAULT-NEXT:    fdiv v0.2d, v2.2d, v0.2d
; FAULT-NEXT:    fdiv v1.2d, v2.2d, v1.2d
; FAULT-NEXT:    ret
;
; CHECK-LABEL: d4rsqrt:
; CHECK:       // %bb.0:
; CHECK-NEXT:    frsqrte v2.2d, v0.2d
; CHECK-NEXT:    fmul v4.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrte v3.2d, v1.2d
; CHECK-NEXT:    frsqrts v4.2d, v0.2d, v4.2d
; CHECK-NEXT:    fmul v2.2d, v2.2d, v4.2d
; CHECK-NEXT:    fmul v4.2d, v3.2d, v3.2d
; CHECK-NEXT:    frsqrts v4.2d, v1.2d, v4.2d
; CHECK-NEXT:    fmul v3.2d, v3.2d, v4.2d
; CHECK-NEXT:    fmul v4.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrts v4.2d, v0.2d, v4.2d
; CHECK-NEXT:    fmul v2.2d, v2.2d, v4.2d
; CHECK-NEXT:    fmul v4.2d, v3.2d, v3.2d
; CHECK-NEXT:    frsqrts v4.2d, v1.2d, v4.2d
; CHECK-NEXT:    fmul v3.2d, v3.2d, v4.2d
; CHECK-NEXT:    fmul v4.2d, v2.2d, v2.2d
; CHECK-NEXT:    frsqrts v0.2d, v0.2d, v4.2d
; CHECK-NEXT:    fmul v4.2d, v3.2d, v3.2d
; CHECK-NEXT:    frsqrts v1.2d, v1.2d, v4.2d
; CHECK-NEXT:    fmul v0.2d, v2.2d, v0.2d
; CHECK-NEXT:    fmul v1.2d, v3.2d, v1.2d
; CHECK-NEXT:    ret
  %1 = tail call fast <4 x double> @llvm.sqrt.v4f64(<4 x double> %a)
  %2 = fdiv fast <4 x double> <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>, %1
  ret <4 x double> %2
}

attributes #0 = { "unsafe-fp-math"="true" }
attributes #1 = { "unsafe-fp-math"="true" "denormal-fp-math"="ieee" }