1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming-compatible-sve < %s | FileCheck %s
5 target triple = "aarch64-unknown-linux-gnu"
7 define <4 x i8> @select_v4i8(<4 x i8> %op1, <4 x i8> %op2, i1 %mask) {
8 ; CHECK-LABEL: select_v4i8:
10 ; CHECK-NEXT: ptrue p0.h
11 ; CHECK-NEXT: mov z2.h, w0
12 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
13 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
14 ; CHECK-NEXT: and z2.h, z2.h, #0x1
15 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
16 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
17 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
19 %sel = select i1 %mask, <4 x i8> %op1, <4 x i8> %op2
23 define <8 x i8> @select_v8i8(<8 x i8> %op1, <8 x i8> %op2, i1 %mask) {
24 ; CHECK-LABEL: select_v8i8:
26 ; CHECK-NEXT: ptrue p0.b
27 ; CHECK-NEXT: mov z2.b, w0
28 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
29 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
30 ; CHECK-NEXT: cmpne p0.b, p0/z, z2.b, #0
31 ; CHECK-NEXT: sel z0.b, p0, z0.b, z1.b
32 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
34 %sel = select i1 %mask, <8 x i8> %op1, <8 x i8> %op2
38 define <16 x i8> @select_v16i8(<16 x i8> %op1, <16 x i8> %op2, i1 %mask) {
39 ; CHECK-LABEL: select_v16i8:
41 ; CHECK-NEXT: ptrue p0.b
42 ; CHECK-NEXT: mov z2.b, w0
43 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
44 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
45 ; CHECK-NEXT: cmpne p0.b, p0/z, z2.b, #0
46 ; CHECK-NEXT: sel z0.b, p0, z0.b, z1.b
47 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
49 %sel = select i1 %mask, <16 x i8> %op1, <16 x i8> %op2
53 define void @select_v32i8(ptr %a, ptr %b, i1 %mask) {
54 ; CHECK-LABEL: select_v32i8:
56 ; CHECK-NEXT: ptrue p0.b
57 ; CHECK-NEXT: mov z0.b, w2
58 ; CHECK-NEXT: cmpne p0.b, p0/z, z0.b, #0
59 ; CHECK-NEXT: ldr q0, [x0]
60 ; CHECK-NEXT: ldr q1, [x0, #16]
61 ; CHECK-NEXT: ldr q2, [x1]
62 ; CHECK-NEXT: ldr q3, [x1, #16]
63 ; CHECK-NEXT: sel z0.b, p0, z0.b, z2.b
64 ; CHECK-NEXT: sel z1.b, p0, z1.b, z3.b
65 ; CHECK-NEXT: stp q0, q1, [x0]
67 %op1 = load volatile <32 x i8>, ptr %a
68 %op2 = load volatile <32 x i8>, ptr %b
69 %sel = select i1 %mask, <32 x i8> %op1, <32 x i8> %op2
70 store <32 x i8> %sel, ptr %a
74 define <2 x i16> @select_v2i16(<2 x i16> %op1, <2 x i16> %op2, i1 %mask) {
75 ; CHECK-LABEL: select_v2i16:
77 ; CHECK-NEXT: ptrue p0.s
78 ; CHECK-NEXT: and w8, w0, #0x1
79 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
80 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
81 ; CHECK-NEXT: mov z2.s, w8
82 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
83 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
84 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
86 %sel = select i1 %mask, <2 x i16> %op1, <2 x i16> %op2
90 define <4 x i16> @select_v4i16(<4 x i16> %op1, <4 x i16> %op2, i1 %mask) {
91 ; CHECK-LABEL: select_v4i16:
93 ; CHECK-NEXT: ptrue p0.h
94 ; CHECK-NEXT: mov z2.h, w0
95 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
96 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
97 ; CHECK-NEXT: and z2.h, z2.h, #0x1
98 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
99 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
100 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
102 %sel = select i1 %mask, <4 x i16> %op1, <4 x i16> %op2
106 define <8 x i16> @select_v8i16(<8 x i16> %op1, <8 x i16> %op2, i1 %mask) {
107 ; CHECK-LABEL: select_v8i16:
109 ; CHECK-NEXT: ptrue p0.h
110 ; CHECK-NEXT: mov z2.h, w0
111 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
112 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
113 ; CHECK-NEXT: and z2.h, z2.h, #0x1
114 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
115 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
116 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
118 %sel = select i1 %mask, <8 x i16> %op1, <8 x i16> %op2
122 define void @select_v16i16(ptr %a, ptr %b, i1 %mask) {
123 ; CHECK-LABEL: select_v16i16:
125 ; CHECK-NEXT: ptrue p0.h
126 ; CHECK-NEXT: mov z0.h, w2
127 ; CHECK-NEXT: and z0.h, z0.h, #0x1
128 ; CHECK-NEXT: cmpne p0.h, p0/z, z0.h, #0
129 ; CHECK-NEXT: ldr q0, [x0]
130 ; CHECK-NEXT: ldr q1, [x0, #16]
131 ; CHECK-NEXT: ldr q2, [x1]
132 ; CHECK-NEXT: ldr q3, [x1, #16]
133 ; CHECK-NEXT: sel z0.h, p0, z0.h, z2.h
134 ; CHECK-NEXT: sel z1.h, p0, z1.h, z3.h
135 ; CHECK-NEXT: stp q0, q1, [x0]
137 %op1 = load volatile <16 x i16>, ptr %a
138 %op2 = load volatile <16 x i16>, ptr %b
139 %sel = select i1 %mask, <16 x i16> %op1, <16 x i16> %op2
140 store <16 x i16> %sel, ptr %a
144 define <2 x i32> @select_v2i32(<2 x i32> %op1, <2 x i32> %op2, i1 %mask) {
145 ; CHECK-LABEL: select_v2i32:
147 ; CHECK-NEXT: ptrue p0.s
148 ; CHECK-NEXT: and w8, w0, #0x1
149 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
150 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
151 ; CHECK-NEXT: mov z2.s, w8
152 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
153 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
154 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
156 %sel = select i1 %mask, <2 x i32> %op1, <2 x i32> %op2
160 define <4 x i32> @select_v4i32(<4 x i32> %op1, <4 x i32> %op2, i1 %mask) {
161 ; CHECK-LABEL: select_v4i32:
163 ; CHECK-NEXT: ptrue p0.s
164 ; CHECK-NEXT: and w8, w0, #0x1
165 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
166 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
167 ; CHECK-NEXT: mov z2.s, w8
168 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
169 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
170 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
172 %sel = select i1 %mask, <4 x i32> %op1, <4 x i32> %op2
176 define void @select_v8i32(ptr %a, ptr %b, i1 %mask) {
177 ; CHECK-LABEL: select_v8i32:
179 ; CHECK-NEXT: ptrue p0.s
180 ; CHECK-NEXT: and w8, w2, #0x1
181 ; CHECK-NEXT: mov z0.s, w8
182 ; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
183 ; CHECK-NEXT: ldr q0, [x0]
184 ; CHECK-NEXT: ldr q1, [x0, #16]
185 ; CHECK-NEXT: ldr q2, [x1]
186 ; CHECK-NEXT: ldr q3, [x1, #16]
187 ; CHECK-NEXT: sel z0.s, p0, z0.s, z2.s
188 ; CHECK-NEXT: sel z1.s, p0, z1.s, z3.s
189 ; CHECK-NEXT: stp q0, q1, [x0]
191 %op1 = load volatile <8 x i32>, ptr %a
192 %op2 = load volatile <8 x i32>, ptr %b
193 %sel = select i1 %mask, <8 x i32> %op1, <8 x i32> %op2
194 store <8 x i32> %sel, ptr %a
198 define <1 x i64> @select_v1i64(<1 x i64> %op1, <1 x i64> %op2, i1 %mask) {
199 ; CHECK-LABEL: select_v1i64:
201 ; CHECK-NEXT: ptrue p0.d
202 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
203 ; CHECK-NEXT: and x8, x0, #0x1
204 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
205 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
206 ; CHECK-NEXT: mov z2.d, x8
207 ; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0
208 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
209 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
211 %sel = select i1 %mask, <1 x i64> %op1, <1 x i64> %op2
215 define <2 x i64> @select_v2i64(<2 x i64> %op1, <2 x i64> %op2, i1 %mask) {
216 ; CHECK-LABEL: select_v2i64:
218 ; CHECK-NEXT: ptrue p0.d
219 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
220 ; CHECK-NEXT: and x8, x0, #0x1
221 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
222 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
223 ; CHECK-NEXT: mov z2.d, x8
224 ; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0
225 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
226 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
228 %sel = select i1 %mask, <2 x i64> %op1, <2 x i64> %op2
232 define void @select_v4i64(ptr %a, ptr %b, i1 %mask) {
233 ; CHECK-LABEL: select_v4i64:
235 ; CHECK-NEXT: ptrue p0.d
236 ; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2
237 ; CHECK-NEXT: and x8, x2, #0x1
238 ; CHECK-NEXT: mov z0.d, x8
239 ; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, #0
240 ; CHECK-NEXT: ldr q0, [x0]
241 ; CHECK-NEXT: ldr q1, [x0, #16]
242 ; CHECK-NEXT: ldr q2, [x1]
243 ; CHECK-NEXT: ldr q3, [x1, #16]
244 ; CHECK-NEXT: sel z0.d, p0, z0.d, z2.d
245 ; CHECK-NEXT: sel z1.d, p0, z1.d, z3.d
246 ; CHECK-NEXT: stp q0, q1, [x0]
248 %op1 = load volatile <4 x i64>, ptr %a
249 %op2 = load volatile <4 x i64>, ptr %b
250 %sel = select i1 %mask, <4 x i64> %op1, <4 x i64> %op2
251 store <4 x i64> %sel, ptr %a