1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s
4 ; A vector TruncStore can not be selected.
5 ; Test a trunc IR and a vector store IR can be selected correctly.
7 define void @v2i64_v2i32(<2 x i64> %a, <2 x i32>* %result) {
8 ; CHECK-LABEL: v2i64_v2i32:
10 ; CHECK-NEXT: xtn v0.2s, v0.2d
11 ; CHECK-NEXT: str d0, [x0]
13 %b = trunc <2 x i64> %a to <2 x i32>
14 store <2 x i32> %b, <2 x i32>* %result
18 define void @v4i64_v4i32(<4 x i64> %a, <4 x i32>* %result) {
19 ; CHECK-LABEL: v4i64_v4i32:
21 ; CHECK-NEXT: xtn v0.2s, v0.2d
22 ; CHECK-NEXT: xtn2 v0.4s, v1.2d
23 ; CHECK-NEXT: str q0, [x0]
25 %b = trunc <4 x i64> %a to <4 x i32>
26 store <4 x i32> %b, <4 x i32>* %result
30 define void @v8i64_v8i32(<8 x i64> %a, <8 x i32>* %result) {
31 ; CHECK-LABEL: v8i64_v8i32:
33 ; CHECK-NEXT: xtn v0.2s, v0.2d
34 ; CHECK-NEXT: xtn v2.2s, v2.2d
35 ; CHECK-NEXT: xtn2 v0.4s, v1.2d
36 ; CHECK-NEXT: xtn2 v2.4s, v3.2d
37 ; CHECK-NEXT: stp q0, q2, [x0]
39 %b = trunc <8 x i64> %a to <8 x i32>
40 store <8 x i32> %b, <8 x i32>* %result
44 define void @v2i32_v2i16(<2 x i32> %a, <2 x i16>* %result) {
45 ; CHECK-LABEL: v2i32_v2i16:
47 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
48 ; CHECK-NEXT: mov w8, v0.s[1]
49 ; CHECK-NEXT: fmov w9, s0
50 ; CHECK-NEXT: strh w8, [x0, #2]
51 ; CHECK-NEXT: strh w9, [x0]
53 %b = trunc <2 x i32> %a to <2 x i16>
54 store <2 x i16> %b, <2 x i16>* %result
58 define void @v4i32_v4i16(<4 x i32> %a, <4 x i16>* %result) {
59 ; CHECK-LABEL: v4i32_v4i16:
61 ; CHECK-NEXT: xtn v0.4h, v0.4s
62 ; CHECK-NEXT: str d0, [x0]
64 %b = trunc <4 x i32> %a to <4 x i16>
65 store <4 x i16> %b, <4 x i16>* %result
69 define void @v8i32_v8i16(<8 x i32> %a, <8 x i16>* %result) {
70 ; CHECK-LABEL: v8i32_v8i16:
72 ; CHECK-NEXT: xtn v0.4h, v0.4s
73 ; CHECK-NEXT: xtn2 v0.8h, v1.4s
74 ; CHECK-NEXT: str q0, [x0]
76 %b = trunc <8 x i32> %a to <8 x i16>
77 store <8 x i16> %b, <8 x i16>* %result
81 define void @v16i32_v16i16(<16 x i32> %a, <16 x i16>* %result) {
82 ; CHECK-LABEL: v16i32_v16i16:
84 ; CHECK-NEXT: xtn v0.4h, v0.4s
85 ; CHECK-NEXT: xtn v2.4h, v2.4s
86 ; CHECK-NEXT: xtn2 v0.8h, v1.4s
87 ; CHECK-NEXT: xtn2 v2.8h, v3.4s
88 ; CHECK-NEXT: stp q0, q2, [x0]
90 %b = trunc <16 x i32> %a to <16 x i16>
91 store <16 x i16> %b, <16 x i16>* %result
95 define void @v2i32_v2i8(<2 x i32> %a, <2 x i8>* %result) {
96 ; CHECK-LABEL: v2i32_v2i8:
98 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
99 ; CHECK-NEXT: mov w8, v0.s[1]
100 ; CHECK-NEXT: fmov w9, s0
101 ; CHECK-NEXT: strb w8, [x0, #1]
102 ; CHECK-NEXT: strb w9, [x0]
104 %b = trunc <2 x i32> %a to <2 x i8>
105 store <2 x i8> %b, <2 x i8>* %result
109 define void @v4i32_v4i8(<4 x i32> %a, <4 x i8>* %result) {
110 ; CHECK-LABEL: v4i32_v4i8:
112 ; CHECK-NEXT: xtn v0.4h, v0.4s
113 ; CHECK-NEXT: xtn v0.8b, v0.8h
114 ; CHECK-NEXT: str s0, [x0]
116 %b = trunc <4 x i32> %a to <4 x i8>
117 store <4 x i8> %b, <4 x i8>* %result
121 define void @v8i32_v8i8(<8 x i32> %a, <8 x i8>* %result) {
122 ; CHECK-LABEL: v8i32_v8i8:
124 ; CHECK-NEXT: xtn v0.4h, v0.4s
125 ; CHECK-NEXT: xtn2 v0.8h, v1.4s
126 ; CHECK-NEXT: xtn v0.8b, v0.8h
127 ; CHECK-NEXT: str d0, [x0]
129 %b = trunc <8 x i32> %a to <8 x i8>
130 store <8 x i8> %b, <8 x i8>* %result
134 define void @v16i32_v16i8(<16 x i32> %a, <16 x i8>* %result) {
135 ; CHECK-LABEL: v16i32_v16i8:
137 ; CHECK-NEXT: xtn v2.4h, v2.4s
138 ; CHECK-NEXT: xtn v0.4h, v0.4s
139 ; CHECK-NEXT: xtn2 v2.8h, v3.4s
140 ; CHECK-NEXT: xtn2 v0.8h, v1.4s
141 ; CHECK-NEXT: xtn v0.8b, v0.8h
142 ; CHECK-NEXT: xtn2 v0.16b, v2.8h
143 ; CHECK-NEXT: str q0, [x0]
145 %b = trunc <16 x i32> %a to <16 x i8>
146 store <16 x i8> %b, <16 x i8>* %result
150 define void @v32i32_v32i8(<32 x i32> %a, <32 x i8>* %result) {
151 ; CHECK-LABEL: v32i32_v32i8:
153 ; CHECK-NEXT: xtn v2.4h, v2.4s
154 ; CHECK-NEXT: xtn v0.4h, v0.4s
155 ; CHECK-NEXT: xtn2 v2.8h, v3.4s
156 ; CHECK-NEXT: xtn2 v0.8h, v1.4s
157 ; CHECK-NEXT: xtn v6.4h, v6.4s
158 ; CHECK-NEXT: xtn v4.4h, v4.4s
159 ; CHECK-NEXT: xtn v0.8b, v0.8h
160 ; CHECK-NEXT: xtn2 v0.16b, v2.8h
161 ; CHECK-NEXT: xtn2 v6.8h, v7.4s
162 ; CHECK-NEXT: xtn2 v4.8h, v5.4s
163 ; CHECK-NEXT: xtn v1.8b, v4.8h
164 ; CHECK-NEXT: xtn2 v1.16b, v6.8h
165 ; CHECK-NEXT: stp q0, q1, [x0]
167 %b = trunc <32 x i32> %a to <32 x i8>
168 store <32 x i8> %b, <32 x i8>* %result
172 define void @v2i16_v2i8(<2 x i16> %a, <2 x i8>* %result) {
173 ; CHECK-LABEL: v2i16_v2i8:
175 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
176 ; CHECK-NEXT: mov w8, v0.s[1]
177 ; CHECK-NEXT: fmov w9, s0
178 ; CHECK-NEXT: strb w8, [x0, #1]
179 ; CHECK-NEXT: strb w9, [x0]
181 %b = trunc <2 x i16> %a to <2 x i8>
182 store <2 x i8> %b, <2 x i8>* %result
186 define void @v4i16_v4i8(<4 x i16> %a, <4 x i8>* %result) {
187 ; CHECK-LABEL: v4i16_v4i8:
189 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
190 ; CHECK-NEXT: xtn v0.8b, v0.8h
191 ; CHECK-NEXT: str s0, [x0]
193 %b = trunc <4 x i16> %a to <4 x i8>
194 store <4 x i8> %b, <4 x i8>* %result
198 define void @v8i16_v8i8(<8 x i16> %a, <8 x i8>* %result) {
199 ; CHECK-LABEL: v8i16_v8i8:
201 ; CHECK-NEXT: xtn v0.8b, v0.8h
202 ; CHECK-NEXT: str d0, [x0]
204 %b = trunc <8 x i16> %a to <8 x i8>
205 store <8 x i8> %b, <8 x i8>* %result
209 define void @v16i16_v16i8(<16 x i16> %a, <16 x i8>* %result) {
210 ; CHECK-LABEL: v16i16_v16i8:
212 ; CHECK-NEXT: xtn v0.8b, v0.8h
213 ; CHECK-NEXT: xtn2 v0.16b, v1.8h
214 ; CHECK-NEXT: str q0, [x0]
216 %b = trunc <16 x i16> %a to <16 x i8>
217 store <16 x i8> %b, <16 x i8>* %result
221 define void @v32i16_v32i8(<32 x i16> %a, <32 x i8>* %result) {
222 ; CHECK-LABEL: v32i16_v32i8:
224 ; CHECK-NEXT: xtn v0.8b, v0.8h
225 ; CHECK-NEXT: xtn v2.8b, v2.8h
226 ; CHECK-NEXT: xtn2 v0.16b, v1.8h
227 ; CHECK-NEXT: xtn2 v2.16b, v3.8h
228 ; CHECK-NEXT: stp q0, q2, [x0]
230 %b = trunc <32 x i16> %a to <32 x i8>
231 store <32 x i8> %b, <32 x i8>* %result