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
4 target triple = "aarch64-unknown-linux-gnu"
6 define <4 x i8> @select_v4i8(<4 x i8> %op1, <4 x i8> %op2, i1 %mask) {
7 ; CHECK-LABEL: select_v4i8:
9 ; CHECK-NEXT: ptrue p0.h
10 ; CHECK-NEXT: mov z2.h, w0
11 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
12 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
13 ; CHECK-NEXT: and z2.h, z2.h, #0x1
14 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
15 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
16 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
18 %sel = select i1 %mask, <4 x i8> %op1, <4 x i8> %op2
22 define <8 x i8> @select_v8i8(<8 x i8> %op1, <8 x i8> %op2, i1 %mask) {
23 ; CHECK-LABEL: select_v8i8:
25 ; CHECK-NEXT: ptrue p0.b
26 ; CHECK-NEXT: mov z2.b, w0
27 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
28 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
29 ; CHECK-NEXT: cmpne p0.b, p0/z, z2.b, #0
30 ; CHECK-NEXT: sel z0.b, p0, z0.b, z1.b
31 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
33 %sel = select i1 %mask, <8 x i8> %op1, <8 x i8> %op2
37 define <16 x i8> @select_v16i8(<16 x i8> %op1, <16 x i8> %op2, i1 %mask) {
38 ; CHECK-LABEL: select_v16i8:
40 ; CHECK-NEXT: ptrue p0.b
41 ; CHECK-NEXT: mov z2.b, w0
42 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
43 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
44 ; CHECK-NEXT: cmpne p0.b, p0/z, z2.b, #0
45 ; CHECK-NEXT: sel z0.b, p0, z0.b, z1.b
46 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
48 %sel = select i1 %mask, <16 x i8> %op1, <16 x i8> %op2
52 define void @select_v32i8(ptr %a, ptr %b, i1 %mask) {
53 ; CHECK-LABEL: select_v32i8:
55 ; CHECK-NEXT: ptrue p0.b
56 ; CHECK-NEXT: mov z0.b, w2
57 ; CHECK-NEXT: cmpne p0.b, p0/z, z0.b, #0
58 ; CHECK-NEXT: ldr q0, [x0]
59 ; CHECK-NEXT: ldr q1, [x0, #16]
60 ; CHECK-NEXT: ldr q2, [x1]
61 ; CHECK-NEXT: ldr q3, [x1, #16]
62 ; CHECK-NEXT: sel z0.b, p0, z0.b, z2.b
63 ; CHECK-NEXT: sel z1.b, p0, z1.b, z3.b
64 ; CHECK-NEXT: stp q0, q1, [x0]
66 %op1 = load volatile <32 x i8>, ptr %a
67 %op2 = load volatile <32 x i8>, ptr %b
68 %sel = select i1 %mask, <32 x i8> %op1, <32 x i8> %op2
69 store <32 x i8> %sel, ptr %a
73 define <2 x i16> @select_v2i16(<2 x i16> %op1, <2 x i16> %op2, i1 %mask) {
74 ; CHECK-LABEL: select_v2i16:
76 ; CHECK-NEXT: ptrue p0.s
77 ; CHECK-NEXT: and w8, w0, #0x1
78 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
79 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
80 ; CHECK-NEXT: mov z2.s, w8
81 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
82 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
83 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
85 %sel = select i1 %mask, <2 x i16> %op1, <2 x i16> %op2
89 define <4 x i16> @select_v4i16(<4 x i16> %op1, <4 x i16> %op2, i1 %mask) {
90 ; CHECK-LABEL: select_v4i16:
92 ; CHECK-NEXT: ptrue p0.h
93 ; CHECK-NEXT: mov z2.h, w0
94 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
95 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
96 ; CHECK-NEXT: and z2.h, z2.h, #0x1
97 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
98 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
99 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
101 %sel = select i1 %mask, <4 x i16> %op1, <4 x i16> %op2
105 define <8 x i16> @select_v8i16(<8 x i16> %op1, <8 x i16> %op2, i1 %mask) {
106 ; CHECK-LABEL: select_v8i16:
108 ; CHECK-NEXT: ptrue p0.h
109 ; CHECK-NEXT: mov z2.h, w0
110 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
111 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
112 ; CHECK-NEXT: and z2.h, z2.h, #0x1
113 ; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0
114 ; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h
115 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
117 %sel = select i1 %mask, <8 x i16> %op1, <8 x i16> %op2
121 define void @select_v16i16(ptr %a, ptr %b, i1 %mask) {
122 ; CHECK-LABEL: select_v16i16:
124 ; CHECK-NEXT: ptrue p0.h
125 ; CHECK-NEXT: mov z0.h, w2
126 ; CHECK-NEXT: and z0.h, z0.h, #0x1
127 ; CHECK-NEXT: cmpne p0.h, p0/z, z0.h, #0
128 ; CHECK-NEXT: ldr q0, [x0]
129 ; CHECK-NEXT: ldr q1, [x0, #16]
130 ; CHECK-NEXT: ldr q2, [x1]
131 ; CHECK-NEXT: ldr q3, [x1, #16]
132 ; CHECK-NEXT: sel z0.h, p0, z0.h, z2.h
133 ; CHECK-NEXT: sel z1.h, p0, z1.h, z3.h
134 ; CHECK-NEXT: stp q0, q1, [x0]
136 %op1 = load volatile <16 x i16>, ptr %a
137 %op2 = load volatile <16 x i16>, ptr %b
138 %sel = select i1 %mask, <16 x i16> %op1, <16 x i16> %op2
139 store <16 x i16> %sel, ptr %a
143 define <2 x i32> @select_v2i32(<2 x i32> %op1, <2 x i32> %op2, i1 %mask) {
144 ; CHECK-LABEL: select_v2i32:
146 ; CHECK-NEXT: ptrue p0.s
147 ; CHECK-NEXT: and w8, w0, #0x1
148 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
149 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
150 ; CHECK-NEXT: mov z2.s, w8
151 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
152 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
153 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
155 %sel = select i1 %mask, <2 x i32> %op1, <2 x i32> %op2
159 define <4 x i32> @select_v4i32(<4 x i32> %op1, <4 x i32> %op2, i1 %mask) {
160 ; CHECK-LABEL: select_v4i32:
162 ; CHECK-NEXT: ptrue p0.s
163 ; CHECK-NEXT: and w8, w0, #0x1
164 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
165 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
166 ; CHECK-NEXT: mov z2.s, w8
167 ; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0
168 ; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s
169 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
171 %sel = select i1 %mask, <4 x i32> %op1, <4 x i32> %op2
175 define void @select_v8i32(ptr %a, ptr %b, i1 %mask) {
176 ; CHECK-LABEL: select_v8i32:
178 ; CHECK-NEXT: ptrue p0.s
179 ; CHECK-NEXT: and w8, w2, #0x1
180 ; CHECK-NEXT: mov z0.s, w8
181 ; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
182 ; CHECK-NEXT: ldr q0, [x0]
183 ; CHECK-NEXT: ldr q1, [x0, #16]
184 ; CHECK-NEXT: ldr q2, [x1]
185 ; CHECK-NEXT: ldr q3, [x1, #16]
186 ; CHECK-NEXT: sel z0.s, p0, z0.s, z2.s
187 ; CHECK-NEXT: sel z1.s, p0, z1.s, z3.s
188 ; CHECK-NEXT: stp q0, q1, [x0]
190 %op1 = load volatile <8 x i32>, ptr %a
191 %op2 = load volatile <8 x i32>, ptr %b
192 %sel = select i1 %mask, <8 x i32> %op1, <8 x i32> %op2
193 store <8 x i32> %sel, ptr %a
197 define <1 x i64> @select_v1i64(<1 x i64> %op1, <1 x i64> %op2, i1 %mask) {
198 ; CHECK-LABEL: select_v1i64:
200 ; CHECK-NEXT: ptrue p0.d
201 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
202 ; CHECK-NEXT: and x8, x0, #0x1
203 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
204 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
205 ; CHECK-NEXT: mov z2.d, x8
206 ; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0
207 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
208 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
210 %sel = select i1 %mask, <1 x i64> %op1, <1 x i64> %op2
214 define <2 x i64> @select_v2i64(<2 x i64> %op1, <2 x i64> %op2, i1 %mask) {
215 ; CHECK-LABEL: select_v2i64:
217 ; CHECK-NEXT: ptrue p0.d
218 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
219 ; CHECK-NEXT: and x8, x0, #0x1
220 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
221 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
222 ; CHECK-NEXT: mov z2.d, x8
223 ; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0
224 ; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d
225 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
227 %sel = select i1 %mask, <2 x i64> %op1, <2 x i64> %op2
231 define void @select_v4i64(ptr %a, ptr %b, i1 %mask) {
232 ; CHECK-LABEL: select_v4i64:
234 ; CHECK-NEXT: ptrue p0.d
235 ; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2
236 ; CHECK-NEXT: and x8, x2, #0x1
237 ; CHECK-NEXT: mov z0.d, x8
238 ; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, #0
239 ; CHECK-NEXT: ldr q0, [x0]
240 ; CHECK-NEXT: ldr q1, [x0, #16]
241 ; CHECK-NEXT: ldr q2, [x1]
242 ; CHECK-NEXT: ldr q3, [x1, #16]
243 ; CHECK-NEXT: sel z0.d, p0, z0.d, z2.d
244 ; CHECK-NEXT: sel z1.d, p0, z1.d, z3.d
245 ; CHECK-NEXT: stp q0, q1, [x0]
247 %op1 = load volatile <4 x i64>, ptr %a
248 %op2 = load volatile <4 x i64>, ptr %b
249 %sel = select i1 %mask, <4 x i64> %op1, <4 x i64> %op2
250 store <4 x i64> %sel, ptr %a