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, ptr %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, ptr %result
18 define void @v4i64_v4i32(<4 x i64> %a, ptr %result) {
19 ; CHECK-LABEL: v4i64_v4i32:
21 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
22 ; CHECK-NEXT: str q0, [x0]
24 %b = trunc <4 x i64> %a to <4 x i32>
25 store <4 x i32> %b, ptr %result
29 define void @v8i64_v8i32(<8 x i64> %a, ptr %result) {
30 ; CHECK-LABEL: v8i64_v8i32:
32 ; CHECK-NEXT: uzp1 v2.4s, v2.4s, v3.4s
33 ; CHECK-NEXT: uzp1 v0.4s, v0.4s, v1.4s
34 ; CHECK-NEXT: stp q0, q2, [x0]
36 %b = trunc <8 x i64> %a to <8 x i32>
37 store <8 x i32> %b, ptr %result
41 define void @v2i32_v2i16(<2 x i32> %a, ptr %result) {
42 ; CHECK-LABEL: v2i32_v2i16:
44 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
45 ; CHECK-NEXT: mov w8, v0.s[1]
46 ; CHECK-NEXT: fmov w9, s0
47 ; CHECK-NEXT: strh w9, [x0]
48 ; CHECK-NEXT: strh w8, [x0, #2]
50 %b = trunc <2 x i32> %a to <2 x i16>
51 store <2 x i16> %b, ptr %result
55 define void @v4i32_v4i16(<4 x i32> %a, ptr %result) {
56 ; CHECK-LABEL: v4i32_v4i16:
58 ; CHECK-NEXT: xtn v0.4h, v0.4s
59 ; CHECK-NEXT: str d0, [x0]
61 %b = trunc <4 x i32> %a to <4 x i16>
62 store <4 x i16> %b, ptr %result
66 define void @v8i32_v8i16(<8 x i32> %a, ptr %result) {
67 ; CHECK-LABEL: v8i32_v8i16:
69 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
70 ; CHECK-NEXT: str q0, [x0]
72 %b = trunc <8 x i32> %a to <8 x i16>
73 store <8 x i16> %b, ptr %result
77 define void @v16i32_v16i16(<16 x i32> %a, ptr %result) {
78 ; CHECK-LABEL: v16i32_v16i16:
80 ; CHECK-NEXT: uzp1 v2.8h, v2.8h, v3.8h
81 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
82 ; CHECK-NEXT: stp q0, q2, [x0]
84 %b = trunc <16 x i32> %a to <16 x i16>
85 store <16 x i16> %b, ptr %result
89 define void @v2i32_v2i8(<2 x i32> %a, ptr %result) {
90 ; CHECK-LABEL: v2i32_v2i8:
92 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
93 ; CHECK-NEXT: mov w8, v0.s[1]
94 ; CHECK-NEXT: fmov w9, s0
95 ; CHECK-NEXT: strb w9, [x0]
96 ; CHECK-NEXT: strb w8, [x0, #1]
98 %b = trunc <2 x i32> %a to <2 x i8>
99 store <2 x i8> %b, ptr %result
103 define void @v4i32_v4i8(<4 x i32> %a, ptr %result) {
104 ; CHECK-LABEL: v4i32_v4i8:
106 ; CHECK-NEXT: xtn v0.4h, v0.4s
107 ; CHECK-NEXT: uzp1 v0.8b, v0.8b, v0.8b
108 ; CHECK-NEXT: str s0, [x0]
110 %b = trunc <4 x i32> %a to <4 x i8>
111 store <4 x i8> %b, ptr %result
115 define void @v8i32_v8i8(<8 x i32> %a, ptr %result) {
116 ; CHECK-LABEL: v8i32_v8i8:
118 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
119 ; CHECK-NEXT: xtn v0.8b, v0.8h
120 ; CHECK-NEXT: str d0, [x0]
122 %b = trunc <8 x i32> %a to <8 x i8>
123 store <8 x i8> %b, ptr %result
127 define void @v16i32_v16i8(<16 x i32> %a, ptr %result) {
128 ; CHECK-LABEL: v16i32_v16i8:
130 ; CHECK-NEXT: uzp1 v2.8h, v2.8h, v3.8h
131 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
132 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v2.16b
133 ; CHECK-NEXT: str q0, [x0]
135 %b = trunc <16 x i32> %a to <16 x i8>
136 store <16 x i8> %b, ptr %result
140 define void @v32i32_v32i8(<32 x i32> %a, ptr %result) {
141 ; CHECK-LABEL: v32i32_v32i8:
143 ; CHECK-NEXT: uzp1 v6.8h, v6.8h, v7.8h
144 ; CHECK-NEXT: uzp1 v4.8h, v4.8h, v5.8h
145 ; CHECK-NEXT: uzp1 v2.8h, v2.8h, v3.8h
146 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
147 ; CHECK-NEXT: uzp1 v1.16b, v4.16b, v6.16b
148 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v2.16b
149 ; CHECK-NEXT: stp q0, q1, [x0]
151 %b = trunc <32 x i32> %a to <32 x i8>
152 store <32 x i8> %b, ptr %result
156 define void @v2i16_v2i8(<2 x i16> %a, ptr %result) {
157 ; CHECK-LABEL: v2i16_v2i8:
159 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
160 ; CHECK-NEXT: mov w8, v0.s[1]
161 ; CHECK-NEXT: fmov w9, s0
162 ; CHECK-NEXT: strb w9, [x0]
163 ; CHECK-NEXT: strb w8, [x0, #1]
165 %b = trunc <2 x i16> %a to <2 x i8>
166 store <2 x i8> %b, ptr %result
170 define void @v4i16_v4i8(<4 x i16> %a, ptr %result) {
171 ; CHECK-LABEL: v4i16_v4i8:
173 ; CHECK-NEXT: uzp1 v0.8b, v0.8b, v0.8b
174 ; CHECK-NEXT: str s0, [x0]
176 %b = trunc <4 x i16> %a to <4 x i8>
177 store <4 x i8> %b, ptr %result
181 define void @v8i16_v8i8(<8 x i16> %a, ptr %result) {
182 ; CHECK-LABEL: v8i16_v8i8:
184 ; CHECK-NEXT: xtn v0.8b, v0.8h
185 ; CHECK-NEXT: str d0, [x0]
187 %b = trunc <8 x i16> %a to <8 x i8>
188 store <8 x i8> %b, ptr %result
192 define void @v16i16_v16i8(<16 x i16> %a, ptr %result) {
193 ; CHECK-LABEL: v16i16_v16i8:
195 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b
196 ; CHECK-NEXT: str q0, [x0]
198 %b = trunc <16 x i16> %a to <16 x i8>
199 store <16 x i8> %b, ptr %result
203 define void @v32i16_v32i8(<32 x i16> %a, ptr %result) {
204 ; CHECK-LABEL: v32i16_v32i8:
206 ; CHECK-NEXT: uzp1 v2.16b, v2.16b, v3.16b
207 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v1.16b
208 ; CHECK-NEXT: stp q0, q2, [x0]
210 %b = trunc <32 x i16> %a to <32 x i8>
211 store <32 x i8> %b, ptr %result