• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5
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
8
9declare float @llvm.sqrt.f32(float) #0
10declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) #0
11declare <8 x float> @llvm.sqrt.v8f32(<8 x float>) #0
12
13define float @foo_x1(float %f) #0 {
14; SCALAR-EST-LABEL: foo_x1:
15; SCALAR-EST:       # %bb.0:
16; SCALAR-EST-NEXT:    rsqrtss %xmm0
17; SCALAR-EST:         retq
18;
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
24  ret float %call
25}
26
27define <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
31; VECTOR-EST:         retq
32;
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
38  ret <4 x float> %call
39}
40
41define <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
45; VECTOR-EST:         retq
46;
47; VECTOR-ACC-LABEL: foo_x8:
48; VECTOR-ACC:       # %bb.0:
49; VECTOR-ACC-NEXT:    {{^ *v?sqrtps %[xy]mm0}}
50; VECTOR-ACC-NOT:     rsqrt
51; VECTOR-ACC:         retq
52  %call = tail call <8 x float> @llvm.sqrt.v8f32(<8 x float> %f) #1
53  ret <8 x float> %call
54}
55
56attributes #0 = { "unsafe-fp-math"="true" }
57attributes #1 = { nounwind readnone }
58