1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mcpu=nehalem | FileCheck %s --check-prefix=SCALAR-EST --check-prefix=VECTOR-EST
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mcpu=sandybridge | FileCheck %s --check-prefix=SCALAR-ACC --check-prefix=VECTOR-EST
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mcpu=broadwell | FileCheck %s --check-prefix=SCALAR-ACC --check-prefix=VECTOR-EST
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mcpu=skylake | FileCheck %s --check-prefix=SCALAR-ACC --check-prefix=VECTOR-ACC
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mattr=+fast-scalar-fsqrt,-fast-vector-fsqrt | FileCheck %s --check-prefix=SCALAR-ACC --check-prefix=VECTOR-EST
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O2 -mattr=-fast-scalar-fsqrt,+fast-vector-fsqrt | FileCheck %s --check-prefix=SCALAR-EST --check-prefix=VECTOR-ACC
9 declare float @llvm.sqrt.f32(float) #0
10 declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #0
11 declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #0
13 define float @foo_x1(float %f) #0 {
14 ; SCALAR-EST-LABEL: foo_x1:
15 ; SCALAR-EST: # %bb.0:
16 ; SCALAR-EST-NEXT: rsqrtss %xmm0
19 ; SCALAR-ACC-LABEL: foo_x1:
20 ; SCALAR-ACC: # %bb.0:
21 ; SCALAR-ACC-NEXT: {{^ *v?sqrtss %xmm0}}
22 ; SCALAR-ACC-NEXT: retq
23 %call = tail call float @llvm.sqrt.f32(float %f) #1
27 define <4 x float> @foo_x4(<4 x float> %f) #0 {
28 ; VECTOR-EST-LABEL: foo_x4:
29 ; VECTOR-EST: # %bb.0:
30 ; VECTOR-EST-NEXT: rsqrtps %xmm0
33 ; VECTOR-ACC-LABEL: foo_x4:
34 ; VECTOR-ACC: # %bb.0:
35 ; VECTOR-ACC-NEXT: {{^ *v?sqrtps %xmm0}}
36 ; VECTOR-ACC-NEXT: retq
37 %call = tail call <4 x float> @llvm.sqrt.v4f32(<4 x float> %f) #1
41 define <8 x float> @foo_x8(<8 x float> %f) #0 {
42 ; VECTOR-EST-LABEL: foo_x8:
43 ; VECTOR-EST: # %bb.0:
44 ; VECTOR-EST-NEXT: rsqrtps
47 ; VECTOR-ACC-LABEL: foo_x8:
48 ; VECTOR-ACC: # %bb.0:
49 ; VECTOR-ACC-NEXT: {{^ *v?sqrtps %[xy]mm0}}
50 ; VECTOR-ACC-NOT: rsqrt
52 %call = tail call <8 x float> @llvm.sqrt.v8f32(<8 x float> %f) #1
56 attributes #0 = { "unsafe-fp-math"="true" }
57 attributes #1 = { nounwind readnone }