1; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s
2; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s
3@a = global float 3.000000e+00, align 4
4@b = global float 4.000000e+00, align 4
5@c = global double 3.000000e+00, align 8
6@d = global double 4.000000e+00, align 8
7
8; Function Attrs: nounwind
9define float @emit_xsaddsp() {
10entry:
11  %0 = load float, float* @a, align 4
12  %1 = load float, float* @b, align 4
13  %add = fadd float %0, %1
14  ret float %add
15; CHECK-LABEL: @emit_xsaddsp
16; CHECK: xsaddsp {{[0-9]+}}
17}
18
19; Function Attrs: nounwind
20define float @emit_xssubsp() {
21entry:
22  %0 = load float, float* @a, align 4
23  %1 = load float, float* @b, align 4
24  %sub = fsub float %0, %1
25  ret float %sub
26; CHECK-LABEL: @emit_xssubsp
27; CHECK: xssubsp {{[0-9]+}}
28}
29
30; Function Attrs: nounwind
31define float @emit_xsdivsp() {
32entry:
33  %0 = load float, float* @a, align 4
34  %1 = load float, float* @b, align 4
35  %div = fdiv float %0, %1
36  ret float %div
37; CHECK-LABEL: @emit_xsdivsp
38; CHECK: xsdivsp {{[0-9]+}}
39}
40
41; Function Attrs: nounwind
42define float @emit_xsmulsp() {
43entry:
44  %0 = load float, float* @a, align 4
45  %1 = load float, float* @b, align 4
46  %mul = fmul float %0, %1
47  ret float %mul
48; CHECK-LABEL: @emit_xsmulsp
49; CHECK: xsmulsp {{[0-9]+}}
50}
51
52; Function Attrs: nounwind
53define float @emit_xssqrtsp() {
54entry:
55  %0 = load float, float* @b, align 4
56  %call = call float @sqrtf(float %0)
57  ret float %call
58; CHECK-LABEL: @emit_xssqrtsp
59; CHECK: xssqrtsp {{[0-9]+}}
60}
61
62; Function Attrs: nounwind
63declare float @sqrtf(float)
64
65; Function Attrs: nounwind
66define double @emit_xsadddp() {
67entry:
68  %0 = load double, double* @c, align 8
69  %1 = load double, double* @d, align 8
70  %add = fadd double %0, %1
71  ret double %add
72; CHECK-LABEL: @emit_xsadddp
73; CHECK: xsadddp {{[0-9]+}}
74}
75
76; Function Attrs: nounwind
77define double @emit_xssubdp() {
78entry:
79  %0 = load double, double* @c, align 8
80  %1 = load double, double* @d, align 8
81  %sub = fsub double %0, %1
82  ret double %sub
83; CHECK-LABEL: @emit_xssubdp
84; CHECK: xssubdp {{[0-9]+}}
85}
86
87; Function Attrs: nounwind
88define double @emit_xsdivdp() {
89entry:
90  %0 = load double, double* @c, align 8
91  %1 = load double, double* @d, align 8
92  %div = fdiv double %0, %1
93  ret double %div
94; CHECK-LABEL: @emit_xsdivdp
95; CHECK: xsdivdp {{[0-9]+}}
96}
97
98; Function Attrs: nounwind
99define double @emit_xsmuldp() {
100entry:
101  %0 = load double, double* @c, align 8
102  %1 = load double, double* @d, align 8
103  %mul = fmul double %0, %1
104  ret double %mul
105; CHECK-LABEL: @emit_xsmuldp
106; CHECK: xsmuldp {{[0-9]+}}
107}
108
109; Function Attrs: nounwind
110define double @emit_xssqrtdp() {
111entry:
112  %0 = load double, double* @d, align 8
113  %call = call double @sqrt(double %0)
114  ret double %call
115; CHECK-LABEL: @emit_xssqrtdp
116; CHECK: xssqrtdp {{[0-9]+}}
117}
118
119; Vector forms
120; Function Attrs: nounwind
121define <4 x float> @emit_xvrsqrtesp() {
122entry:
123; CHECK-LABEL: @emit_xvrsqrtesp
124  %vf = alloca <4 x float>, align 16
125  %vfr = alloca <4 x float>, align 16
126  %0 = load <4 x float>, <4 x float>* %vf, align 16
127  %call = call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %0)
128; CHECK: xvrsqrtesp {{[0-9]+}}, {{[0-9]+}}
129  ret <4 x float> %call
130}
131
132; Function Attrs: nounwind
133define <2 x double> @emit_xvrsqrtedp() {
134entry:
135; CHECK-LABEL: @emit_xvrsqrtedp
136  %vd = alloca <2 x double>, align 16
137  %vdr = alloca <2 x double>, align 16
138  %0 = load <2 x double>, <2 x double>* %vd, align 16
139  %call = call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %0)
140  ret <2 x double> %call
141; CHECK: xvrsqrtedp {{[0-9]+}}, {{[0-9]+}}
142}
143
144; Function Attrs: nounwind
145declare double @sqrt(double)
146
147; Function Attrs: nounwind readnone
148declare <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float>)
149
150; Function Attrs: nounwind readnone
151declare <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double>)
152