1 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu \
2 ; RUN: -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu \
4 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK-BE
5 define double @test1(<2 x i64> %a) {
8 ; CHECK: xxswapd [[SW:[0-9]+]], 34
9 ; CHECK: xscvsxddp 1, [[SW]]
10 ; CHECK-BE-LABEL: test1
11 ; CHECK-BE: xxlor [[CP:[0-9]+]], 34, 34
12 ; CHECK-BE: xscvsxddp 1, [[CP]]
13 %0 = extractelement <2 x i64> %a, i32 0
14 %1 = sitofp i64 %0 to double
18 define double @test2(<2 x i64> %a) {
21 ; CHECK: xxlor [[CP:[0-9]+]], 34, 34
22 ; CHECK: xscvsxddp 1, [[CP]]
23 ; CHECK-BE-LABEL: test2
24 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
25 ; CHECK-BE: xscvsxddp 1, [[SW]]
26 %0 = extractelement <2 x i64> %a, i32 1
27 %1 = sitofp i64 %0 to double
31 define float @test1f(<2 x i64> %a) {
34 ; CHECK: xxswapd [[SW:[0-9]+]], 34
35 ; CHECK: xscvsxdsp 1, [[SW]]
36 ; CHECK-BE-LABEL: test1f
37 ; CHECK-BE: xxlor [[CP:[0-9]+]], 34, 34
38 ; CHECK-BE: xscvsxdsp 1, [[CP]]
39 %0 = extractelement <2 x i64> %a, i32 0
40 %1 = sitofp i64 %0 to float
44 define float @test2f(<2 x i64> %a) {
47 ; CHECK: xxlor [[CP:[0-9]+]], 34, 34
48 ; CHECK: xscvsxdsp 1, [[CP]]
49 ; CHECK-BE-LABEL: test2f
50 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
51 ; CHECK-BE: xscvsxdsp 1, [[SW]]
52 %0 = extractelement <2 x i64> %a, i32 1
53 %1 = sitofp i64 %0 to float
57 define double @test1u(<2 x i64> %a) {
60 ; CHECK: xxswapd [[SW:[0-9]+]], 34
61 ; CHECK: xscvuxddp 1, [[SW]]
62 ; CHECK-BE-LABEL: test1u
63 ; CHECK-BE: xxlor [[CP:[0-9]+]], 34, 34
64 ; CHECK-BE: xscvuxddp 1, [[CP]]
65 %0 = extractelement <2 x i64> %a, i32 0
66 %1 = uitofp i64 %0 to double
70 define double @test2u(<2 x i64> %a) {
73 ; CHECK: xxlor [[CP:[0-9]+]], 34, 34
74 ; CHECK: xscvuxddp 1, [[CP]]
75 ; CHECK-BE-LABEL: test2u
76 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
77 ; CHECK-BE: xscvuxddp 1, [[SW]]
78 %0 = extractelement <2 x i64> %a, i32 1
79 %1 = uitofp i64 %0 to double
83 define float @test1fu(<2 x i64> %a) {
85 ; CHECK-LABEL: test1fu
86 ; CHECK: xxswapd [[SW:[0-9]+]], 34
87 ; CHECK: xscvuxdsp 1, [[SW]]
88 ; CHECK-BE-LABEL: test1fu
89 ; CHECK-BE: xxlor [[CP:[0-9]+]], 34, 34
90 ; CHECK-BE: xscvuxdsp 1, [[CP]]
91 %0 = extractelement <2 x i64> %a, i32 0
92 %1 = uitofp i64 %0 to float
96 define float @test2fu(<2 x i64> %a) {
98 ; CHECK-LABEL: test2fu
99 ; CHECK: xxlor [[CP:[0-9]+]], 34, 34
100 ; CHECK: xscvuxdsp 1, [[CP]]
101 ; CHECK-BE-LABEL: test2fu
102 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
103 ; CHECK-BE: xscvuxdsp 1, [[SW]]
104 %0 = extractelement <2 x i64> %a, i32 1
105 %1 = uitofp i64 %0 to float
109 define float @conv2fltTesti0(<4 x i32> %a) {
111 ; CHECK-LABEL: conv2fltTesti0
112 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 3
113 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
114 ; CHECK: xscvspdpn 1, [[SW]]
115 ; CHECK-BE-LABEL: conv2fltTesti0
116 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 0
117 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
118 ; CHECK-BE: xscvspdpn 1, [[CP]]
119 %vecext = extractelement <4 x i32> %a, i32 0
120 %conv = sitofp i32 %vecext to float
124 define float @conv2fltTesti1(<4 x i32> %a) {
126 ; CHECK-LABEL: conv2fltTesti1
127 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 2
128 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
129 ; CHECK: xscvspdpn 1, [[SW]]
130 ; CHECK-BE-LABEL: conv2fltTesti1
131 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 1
132 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
133 ; CHECK-BE: xscvspdpn 1, [[CP]]
134 %vecext = extractelement <4 x i32> %a, i32 1
135 %conv = sitofp i32 %vecext to float
139 define float @conv2fltTesti2(<4 x i32> %a) {
141 ; CHECK-LABEL: conv2fltTesti2
142 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 1
143 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
144 ; CHECK: xscvspdpn 1, [[SW]]
145 ; CHECK-BE-LABEL: conv2fltTesti2
146 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 2
147 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
148 ; CHECK-BE: xscvspdpn 1, [[CP]]
149 %vecext = extractelement <4 x i32> %a, i32 2
150 %conv = sitofp i32 %vecext to float
154 define float @conv2fltTesti3(<4 x i32> %a) {
156 ; CHECK-LABEL: conv2fltTesti3
157 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 0
158 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
159 ; CHECK: xscvspdpn 1, [[SW]]
160 ; CHECK-BE-LABEL: conv2fltTesti3
161 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 3
162 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
163 ; CHECK-BE: xscvspdpn 1, [[CP]]
164 %vecext = extractelement <4 x i32> %a, i32 3
165 %conv = sitofp i32 %vecext to float
169 ; verify we don't crash for variable elem extract
170 define float @conv2fltTestiVar(<4 x i32> %a, i32 zeroext %elem) {
172 %vecext = extractelement <4 x i32> %a, i32 %elem
173 %conv = sitofp i32 %vecext to float
177 define double @conv2dblTesti0(<4 x i32> %a) {
179 ; CHECK-LABEL: conv2dblTesti0
180 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 3
181 ; CHECK: xvcvsxwdp 1, [[SW]]
182 ; CHECK-BE-LABEL: conv2dblTesti0
183 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 0
184 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
185 %vecext = extractelement <4 x i32> %a, i32 0
186 %conv = sitofp i32 %vecext to double
190 define double @conv2dblTesti1(<4 x i32> %a) {
192 ; CHECK-LABEL: conv2dblTesti1
193 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 2
194 ; CHECK: xvcvsxwdp 1, [[SW]]
195 ; CHECK-BE-LABEL: conv2dblTesti1
196 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 1
197 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
198 %vecext = extractelement <4 x i32> %a, i32 1
199 %conv = sitofp i32 %vecext to double
203 define double @conv2dblTesti2(<4 x i32> %a) {
205 ; CHECK-LABEL: conv2dblTesti2
206 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 1
207 ; CHECK: xvcvsxwdp 1, [[SW]]
208 ; CHECK-BE-LABEL: conv2dblTesti2
209 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 2
210 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
211 %vecext = extractelement <4 x i32> %a, i32 2
212 %conv = sitofp i32 %vecext to double
216 define double @conv2dblTesti3(<4 x i32> %a) {
218 ; CHECK-LABEL: conv2dblTesti3
219 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 0
220 ; CHECK: xvcvsxwdp 1, [[SW]]
221 ; CHECK-BE-LABEL: conv2dblTesti3
222 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 3
223 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
224 %vecext = extractelement <4 x i32> %a, i32 3
225 %conv = sitofp i32 %vecext to double
229 ; verify we don't crash for variable elem extract
230 define double @conv2dblTestiVar(<4 x i32> %a, i32 zeroext %elem) {
232 %vecext = extractelement <4 x i32> %a, i32 %elem
233 %conv = sitofp i32 %vecext to double