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: xscvsxddp 1, 34
12 %0 = extractelement <2 x i64> %a, i32 0
13 %1 = sitofp i64 %0 to double
17 define double @test2(<2 x i64> %a) {
20 ; CHECK: xscvsxddp 1, 34
21 ; CHECK-BE-LABEL: test2
22 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
23 ; CHECK-BE: xscvsxddp 1, [[SW]]
24 %0 = extractelement <2 x i64> %a, i32 1
25 %1 = sitofp i64 %0 to double
29 define float @test1f(<2 x i64> %a) {
32 ; CHECK: xxswapd [[SW:[0-9]+]], 34
33 ; CHECK: xscvsxdsp 1, [[SW]]
34 ; CHECK-BE-LABEL: test1f
35 ; CHECK-BE: xscvsxdsp 1, 34
36 %0 = extractelement <2 x i64> %a, i32 0
37 %1 = sitofp i64 %0 to float
41 define float @test2f(<2 x i64> %a) {
44 ; CHECK: xscvsxdsp 1, 34
45 ; CHECK-BE-LABEL: test2f
46 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
47 ; CHECK-BE: xscvsxdsp 1, [[SW]]
48 %0 = extractelement <2 x i64> %a, i32 1
49 %1 = sitofp i64 %0 to float
53 define double @test1u(<2 x i64> %a) {
56 ; CHECK: xxswapd [[SW:[0-9]+]], 34
57 ; CHECK: xscvuxddp 1, [[SW]]
58 ; CHECK-BE-LABEL: test1u
59 ; CHECK-BE: xscvuxddp 1, 34
60 %0 = extractelement <2 x i64> %a, i32 0
61 %1 = uitofp i64 %0 to double
65 define double @test2u(<2 x i64> %a) {
68 ; CHECK: xscvuxddp 1, 34
69 ; CHECK-BE-LABEL: test2u
70 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
71 ; CHECK-BE: xscvuxddp 1, [[SW]]
72 %0 = extractelement <2 x i64> %a, i32 1
73 %1 = uitofp i64 %0 to double
77 define float @test1fu(<2 x i64> %a) {
79 ; CHECK-LABEL: test1fu
80 ; CHECK: xxswapd [[SW:[0-9]+]], 34
81 ; CHECK: xscvuxdsp 1, [[SW]]
82 ; CHECK-BE-LABEL: test1fu
83 ; CHECK-BE: xscvuxdsp 1, 34
84 %0 = extractelement <2 x i64> %a, i32 0
85 %1 = uitofp i64 %0 to float
89 define float @test2fu(<2 x i64> %a) {
91 ; CHECK-LABEL: test2fu
92 ; CHECK: xscvuxdsp 1, 34
93 ; CHECK-BE-LABEL: test2fu
94 ; CHECK-BE: xxswapd [[SW:[0-9]+]], 34
95 ; CHECK-BE: xscvuxdsp 1, [[SW]]
96 %0 = extractelement <2 x i64> %a, i32 1
97 %1 = uitofp i64 %0 to float
101 define float @conv2fltTesti0(<4 x i32> %a) {
103 ; CHECK-LABEL: conv2fltTesti0
104 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 3
105 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
106 ; CHECK: xscvspdpn 1, [[SW]]
107 ; CHECK-BE-LABEL: conv2fltTesti0
108 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 0
109 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
110 ; CHECK-BE: xscvspdpn 1, [[CP]]
111 %vecext = extractelement <4 x i32> %a, i32 0
112 %conv = sitofp i32 %vecext to float
116 define float @conv2fltTesti1(<4 x i32> %a) {
118 ; CHECK-LABEL: conv2fltTesti1
119 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 2
120 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
121 ; CHECK: xscvspdpn 1, [[SW]]
122 ; CHECK-BE-LABEL: conv2fltTesti1
123 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 1
124 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
125 ; CHECK-BE: xscvspdpn 1, [[CP]]
126 %vecext = extractelement <4 x i32> %a, i32 1
127 %conv = sitofp i32 %vecext to float
131 define float @conv2fltTesti2(<4 x i32> %a) {
133 ; CHECK-LABEL: conv2fltTesti2
134 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 1
135 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
136 ; CHECK: xscvspdpn 1, [[SW]]
137 ; CHECK-BE-LABEL: conv2fltTesti2
138 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 2
139 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
140 ; CHECK-BE: xscvspdpn 1, [[CP]]
141 %vecext = extractelement <4 x i32> %a, i32 2
142 %conv = sitofp i32 %vecext to float
146 define float @conv2fltTesti3(<4 x i32> %a) {
148 ; CHECK-LABEL: conv2fltTesti3
149 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 0
150 ; CHECK: xvcvsxwsp [[SW]], [[SW]]
151 ; CHECK: xscvspdpn 1, [[SW]]
152 ; CHECK-BE-LABEL: conv2fltTesti3
153 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 3
154 ; CHECK-BE: xvcvsxwsp [[CP]], [[CP]]
155 ; CHECK-BE: xscvspdpn 1, [[CP]]
156 %vecext = extractelement <4 x i32> %a, i32 3
157 %conv = sitofp i32 %vecext to float
161 ; verify we don't crash for variable elem extract
162 define float @conv2fltTestiVar(<4 x i32> %a, i32 zeroext %elem) {
164 %vecext = extractelement <4 x i32> %a, i32 %elem
165 %conv = sitofp i32 %vecext to float
169 define double @conv2dblTesti0(<4 x i32> %a) {
171 ; CHECK-LABEL: conv2dblTesti0
172 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 3
173 ; CHECK: xvcvsxwdp 1, [[SW]]
174 ; CHECK-BE-LABEL: conv2dblTesti0
175 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 0
176 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
177 %vecext = extractelement <4 x i32> %a, i32 0
178 %conv = sitofp i32 %vecext to double
182 define double @conv2dblTesti1(<4 x i32> %a) {
184 ; CHECK-LABEL: conv2dblTesti1
185 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 2
186 ; CHECK: xvcvsxwdp 1, [[SW]]
187 ; CHECK-BE-LABEL: conv2dblTesti1
188 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 1
189 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
190 %vecext = extractelement <4 x i32> %a, i32 1
191 %conv = sitofp i32 %vecext to double
195 define double @conv2dblTesti2(<4 x i32> %a) {
197 ; CHECK-LABEL: conv2dblTesti2
198 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 1
199 ; CHECK: xvcvsxwdp 1, [[SW]]
200 ; CHECK-BE-LABEL: conv2dblTesti2
201 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 2
202 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
203 %vecext = extractelement <4 x i32> %a, i32 2
204 %conv = sitofp i32 %vecext to double
208 define double @conv2dblTesti3(<4 x i32> %a) {
210 ; CHECK-LABEL: conv2dblTesti3
211 ; CHECK: xxspltw [[SW:[0-9]+]], 34, 0
212 ; CHECK: xvcvsxwdp 1, [[SW]]
213 ; CHECK-BE-LABEL: conv2dblTesti3
214 ; CHECK-BE: xxspltw [[CP:[0-9]+]], 34, 3
215 ; CHECK-BE: xvcvsxwdp 1, [[CP]]
216 %vecext = extractelement <4 x i32> %a, i32 3
217 %conv = sitofp i32 %vecext to double
221 ; verify we don't crash for variable elem extract
222 define double @conv2dblTestiVar(<4 x i32> %a, i32 zeroext %elem) {
224 %vecext = extractelement <4 x i32> %a, i32 %elem
225 %conv = sitofp i32 %vecext to double