1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=aarch64-apple-darwin -mattr=+neon -verify-machineinstrs < %s | FileCheck %s
4 define void @store_16_elements(<16 x i8> %vec, ptr %out) {
6 ; CHECK-LABEL: store_16_elements:
9 ; CHECK-NEXT: adrp x8, lCPI0_0@PAGE
10 ; CHECK-NEXT: cmeq.16b v0, v0, #0
12 ; CHECK-NEXT: ldr q1, [x8, lCPI0_0@PAGEOFF]
13 ; CHECK-NEXT: bic.16b v0, v1, v0
14 ; CHECK-NEXT: ext.16b v1, v0, v0, #8
15 ; CHECK-NEXT: zip1.16b v0, v0, v1
16 ; CHECK-NEXT: addv.8h h0, v0
17 ; CHECK-NEXT: str h0, [x0]
19 ; CHECK-NEXT: .loh AdrpLdr Lloh0, Lloh1
23 %cmp_result = icmp ne <16 x i8> %vec, zeroinitializer
24 store <16 x i1> %cmp_result, ptr %out
28 define void @store_8_elements(<8 x i16> %vec, ptr %out) {
29 ; CHECK-LABEL: store_8_elements:
32 ; CHECK-NEXT: adrp x8, lCPI1_0@PAGE
33 ; CHECK-NEXT: cmeq.8h v0, v0, #0
35 ; CHECK-NEXT: ldr q1, [x8, lCPI1_0@PAGEOFF]
36 ; CHECK-NEXT: bic.16b v0, v1, v0
37 ; CHECK-NEXT: addv.8h h0, v0
38 ; CHECK-NEXT: fmov w8, s0
39 ; CHECK-NEXT: strb w8, [x0]
41 ; CHECK-NEXT: .loh AdrpLdr Lloh2, Lloh3
44 %cmp_result = icmp ne <8 x i16> %vec, zeroinitializer
45 store <8 x i1> %cmp_result, ptr %out
49 define void @store_4_elements(<4 x i32> %vec, ptr %out) {
50 ; CHECK-LABEL: store_4_elements:
53 ; CHECK-NEXT: adrp x8, lCPI2_0@PAGE
54 ; CHECK-NEXT: cmeq.4s v0, v0, #0
56 ; CHECK-NEXT: ldr q1, [x8, lCPI2_0@PAGEOFF]
57 ; CHECK-NEXT: bic.16b v0, v1, v0
58 ; CHECK-NEXT: addv.4s s0, v0
59 ; CHECK-NEXT: fmov w8, s0
60 ; CHECK-NEXT: strb w8, [x0]
62 ; CHECK-NEXT: .loh AdrpLdr Lloh4, Lloh5
65 %cmp_result = icmp ne <4 x i32> %vec, zeroinitializer
66 store <4 x i1> %cmp_result, ptr %out
70 define void @store_2_elements(<2 x i64> %vec, ptr %out) {
71 ; CHECK-LABEL: store_2_elements:
74 ; CHECK-NEXT: adrp x8, lCPI3_0@PAGE
75 ; CHECK-NEXT: cmeq.2d v0, v0, #0
77 ; CHECK-NEXT: ldr q1, [x8, lCPI3_0@PAGEOFF]
78 ; CHECK-NEXT: bic.16b v0, v1, v0
79 ; CHECK-NEXT: addp.2d d0, v0
80 ; CHECK-NEXT: fmov x8, d0
81 ; CHECK-NEXT: strb w8, [x0]
83 ; CHECK-NEXT: .loh AdrpLdr Lloh6, Lloh7
86 %cmp_result = icmp ne <2 x i64> %vec, zeroinitializer
87 store <2 x i1> %cmp_result, ptr %out
91 define void @add_trunc_compare_before_store(<4 x i32> %vec, ptr %out) {
92 ; CHECK-LABEL: add_trunc_compare_before_store:
94 ; CHECK-NEXT: shl.4s v0, v0, #31
96 ; CHECK-NEXT: adrp x8, lCPI4_0@PAGE
98 ; CHECK-NEXT: ldr q1, [x8, lCPI4_0@PAGEOFF]
99 ; CHECK-NEXT: cmlt.4s v0, v0, #0
100 ; CHECK-NEXT: and.16b v0, v0, v1
101 ; CHECK-NEXT: addv.4s s0, v0
102 ; CHECK-NEXT: fmov w8, s0
103 ; CHECK-NEXT: strb w8, [x0]
105 ; CHECK-NEXT: .loh AdrpLdr Lloh8, Lloh9
108 %trunc = trunc <4 x i32> %vec to <4 x i1>
109 store <4 x i1> %trunc, ptr %out
113 define void @add_trunc_mask_unknown_vector_type(<4 x i1> %vec, ptr %out) {
114 ; CHECK-LABEL: add_trunc_mask_unknown_vector_type:
116 ; CHECK-NEXT: shl.4h v0, v0, #15
117 ; CHECK-NEXT: Lloh10:
118 ; CHECK-NEXT: adrp x8, lCPI5_0@PAGE
119 ; CHECK-NEXT: Lloh11:
120 ; CHECK-NEXT: ldr d1, [x8, lCPI5_0@PAGEOFF]
121 ; CHECK-NEXT: cmlt.4h v0, v0, #0
122 ; CHECK-NEXT: and.8b v0, v0, v1
123 ; CHECK-NEXT: addv.4h h0, v0
124 ; CHECK-NEXT: fmov w8, s0
125 ; CHECK-NEXT: strb w8, [x0]
127 ; CHECK-NEXT: .loh AdrpLdr Lloh10, Lloh11
130 store <4 x i1> %vec, ptr %out
134 define void @store_8_elements_64_bit_vector(<8 x i8> %vec, ptr %out) {
135 ; CHECK-LABEL: store_8_elements_64_bit_vector:
137 ; CHECK-NEXT: Lloh12:
138 ; CHECK-NEXT: adrp x8, lCPI6_0@PAGE
139 ; CHECK-NEXT: cmeq.8b v0, v0, #0
140 ; CHECK-NEXT: Lloh13:
141 ; CHECK-NEXT: ldr d1, [x8, lCPI6_0@PAGEOFF]
142 ; CHECK-NEXT: bic.8b v0, v1, v0
143 ; CHECK-NEXT: addv.8b b0, v0
144 ; CHECK-NEXT: st1.b { v0 }[0], [x0]
146 ; CHECK-NEXT: .loh AdrpLdr Lloh12, Lloh13
149 %cmp_result = icmp ne <8 x i8> %vec, zeroinitializer
150 store <8 x i1> %cmp_result, ptr %out
154 define void @store_4_elements_64_bit_vector(<4 x i16> %vec, ptr %out) {
155 ; CHECK-LABEL: store_4_elements_64_bit_vector:
157 ; CHECK-NEXT: Lloh14:
158 ; CHECK-NEXT: adrp x8, lCPI7_0@PAGE
159 ; CHECK-NEXT: cmeq.4h v0, v0, #0
160 ; CHECK-NEXT: Lloh15:
161 ; CHECK-NEXT: ldr d1, [x8, lCPI7_0@PAGEOFF]
162 ; CHECK-NEXT: bic.8b v0, v1, v0
163 ; CHECK-NEXT: addv.4h h0, v0
164 ; CHECK-NEXT: fmov w8, s0
165 ; CHECK-NEXT: strb w8, [x0]
167 ; CHECK-NEXT: .loh AdrpLdr Lloh14, Lloh15
170 %cmp_result = icmp ne <4 x i16> %vec, zeroinitializer
171 store <4 x i1> %cmp_result, ptr %out
175 define void @store_2_elements_64_bit_vector(<2 x i32> %vec, ptr %out) {
176 ; CHECK-LABEL: store_2_elements_64_bit_vector:
178 ; CHECK-NEXT: Lloh16:
179 ; CHECK-NEXT: adrp x8, lCPI8_0@PAGE
180 ; CHECK-NEXT: cmeq.2s v0, v0, #0
181 ; CHECK-NEXT: Lloh17:
182 ; CHECK-NEXT: ldr d1, [x8, lCPI8_0@PAGEOFF]
183 ; CHECK-NEXT: bic.8b v0, v1, v0
184 ; CHECK-NEXT: addp.2s v0, v0, v0
185 ; CHECK-NEXT: fmov w8, s0
186 ; CHECK-NEXT: strb w8, [x0]
188 ; CHECK-NEXT: .loh AdrpLdr Lloh16, Lloh17
191 %cmp_result = icmp ne <2 x i32> %vec, zeroinitializer
192 store <2 x i1> %cmp_result, ptr %out
196 define void @no_combine_without_truncate(<16 x i8> %vec, ptr %out) {
197 ; CHECK-LABEL: no_combine_without_truncate:
199 ; CHECK-NEXT: cmtst.16b v0, v0, v0
200 ; CHECK-NEXT: str q0, [x0]
203 %cmp_result = icmp ne <16 x i8> %vec, zeroinitializer
204 %extended_result = sext <16 x i1> %cmp_result to <16 x i8>
205 store <16 x i8> %extended_result, ptr %out
209 define void @no_combine_for_non_bool_truncate(<4 x i32> %vec, ptr %out) {
210 ; CHECK-LABEL: no_combine_for_non_bool_truncate:
212 ; CHECK-NEXT: xtn.4h v0, v0
213 ; CHECK-NEXT: uzp1.8b v0, v0, v0
214 ; CHECK-NEXT: str s0, [x0]
217 %trunc = trunc <4 x i32> %vec to <4 x i8>
218 store <4 x i8> %trunc, ptr %out
222 define void @no_combine_for_build_vector(i1 %a, i1 %b, i1 %c, i1 %d, ptr %out) {
223 ; CHECK-LABEL: no_combine_for_build_vector:
225 ; CHECK-NEXT: orr w8, w0, w1, lsl #1
226 ; CHECK-NEXT: orr w8, w8, w2, lsl #2
227 ; CHECK-NEXT: orr w8, w8, w3, lsl #3
228 ; CHECK-NEXT: strb w8, [x4]
231 %1 = insertelement <4 x i1> undef, i1 %a, i64 0
232 %2 = insertelement <4 x i1> %1, i1 %b, i64 1
233 %3 = insertelement <4 x i1> %2, i1 %c, i64 2
234 %vec = insertelement <4 x i1> %3, i1 %d, i64 3
235 store <4 x i1> %vec, ptr %out