1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve --verify-machineinstrs %s -o - | FileCheck %s
4 define void @vctp8(i32 %arg, ptr %in, ptr %out) {
7 ; CHECK-NEXT: vldrw.u32 q1, [r1]
8 ; CHECK-NEXT: vctp.8 r0
9 ; CHECK-NEXT: vmov.i32 q0, #0x0
11 ; CHECK-NEXT: vmovt q0, q1
12 ; CHECK-NEXT: vstrw.32 q0, [r2]
14 %pred = call <16 x i1> @llvm.arm.mve.vctp8(i32 %arg)
15 %ld = load <16 x i8>, ptr %in
16 %res = select <16 x i1> %pred, <16 x i8> %ld, <16 x i8> zeroinitializer
17 store <16 x i8> %res, ptr %out
21 define void @vctp16(i32 %arg, ptr %in, ptr %out) {
22 ; CHECK-LABEL: vctp16:
24 ; CHECK-NEXT: vldrw.u32 q1, [r1]
25 ; CHECK-NEXT: vctp.16 r0
26 ; CHECK-NEXT: vmov.i32 q0, #0x0
28 ; CHECK-NEXT: vmovt q0, q1
29 ; CHECK-NEXT: vstrw.32 q0, [r2]
31 %pred = call <8 x i1> @llvm.arm.mve.vctp16(i32 %arg)
32 %ld = load <8 x i16>, ptr %in
33 %res = select <8 x i1> %pred, <8 x i16> %ld, <8 x i16> zeroinitializer
34 store <8 x i16> %res, ptr %out
38 define void @vctp32(i32 %arg, ptr %in, ptr %out) {
39 ; CHECK-LABEL: vctp32:
41 ; CHECK-NEXT: vldrw.u32 q1, [r1]
42 ; CHECK-NEXT: vctp.32 r0
43 ; CHECK-NEXT: vmov.i32 q0, #0x0
45 ; CHECK-NEXT: vmovt q0, q1
46 ; CHECK-NEXT: vstrw.32 q0, [r2]
48 %pred = call <4 x i1> @llvm.arm.mve.vctp32(i32 %arg)
49 %ld = load <4 x i32>, ptr %in
50 %res = select <4 x i1> %pred, <4 x i32> %ld, <4 x i32> zeroinitializer
51 store <4 x i32> %res, ptr %out
55 define void @vctp64(i32 %arg, ptr %in, ptr %out) {
56 ; CHECK-LABEL: vctp64:
58 ; CHECK-NEXT: vldrw.u32 q1, [r1]
59 ; CHECK-NEXT: vctp.64 r0
60 ; CHECK-NEXT: vmov.i32 q0, #0x0
62 ; CHECK-NEXT: vmovt q0, q1
63 ; CHECK-NEXT: vstrw.32 q0, [r2]
65 %pred = call <2 x i1> @llvm.arm.mve.vctp64(i32 %arg)
66 %ld = load <2 x i64>, ptr %in
67 %res = select <2 x i1> %pred, <2 x i64> %ld, <2 x i64> zeroinitializer
68 store <2 x i64> %res, ptr %out
72 define arm_aapcs_vfpcc <4 x i32> @vcmp_ult_v4i32(i32 %n, <4 x i32> %a, <4 x i32> %b) {
73 ; CHECK-LABEL: vcmp_ult_v4i32:
74 ; CHECK: @ %bb.0: @ %entry
75 ; CHECK-NEXT: vctp.32 r0
77 ; CHECK-NEXT: vmovt q1, q0
78 ; CHECK-NEXT: vmov q0, q1
81 %i = insertelement <4 x i32> undef, i32 %n, i32 0
82 %ns = shufflevector <4 x i32> %i, <4 x i32> undef, <4 x i32> zeroinitializer
83 %c = icmp ult <4 x i32> <i32 0, i32 1, i32 2, i32 3>, %ns
84 %s = select <4 x i1> %c, <4 x i32> %a, <4 x i32> %b
88 define arm_aapcs_vfpcc <4 x i32> @vcmp_uge_v4i32(i32 %n, <4 x i32> %a, <4 x i32> %b) {
89 ; CHECK-LABEL: vcmp_uge_v4i32:
90 ; CHECK: @ %bb.0: @ %entry
91 ; CHECK-NEXT: vctp.32 r0
93 ; CHECK-NEXT: vmovt q1, q0
94 ; CHECK-NEXT: vmov q0, q1
97 %i = insertelement <4 x i32> undef, i32 %n, i32 0
98 %ns = shufflevector <4 x i32> %i, <4 x i32> undef, <4 x i32> zeroinitializer
99 %c = icmp uge <4 x i32> %ns, <i32 0, i32 1, i32 2, i32 3>
100 %s = select <4 x i1> %c, <4 x i32> %a, <4 x i32> %b
104 define arm_aapcs_vfpcc <4 x i32> @vcmp_ult_v4i32_undef(i32 %n, <4 x i32> %a, <4 x i32> %b) {
105 ; CHECK-LABEL: vcmp_ult_v4i32_undef:
106 ; CHECK: @ %bb.0: @ %entry
107 ; CHECK-NEXT: vctp.32 r0
109 ; CHECK-NEXT: vmovt q1, q0
110 ; CHECK-NEXT: vmov q0, q1
113 %i = insertelement <4 x i32> undef, i32 %n, i32 0
114 %ns = shufflevector <4 x i32> %i, <4 x i32> undef, <4 x i32> zeroinitializer
115 %c = icmp ult <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>, %ns
116 %s = select <4 x i1> %c, <4 x i32> %a, <4 x i32> %b
121 define arm_aapcs_vfpcc <8 x i16> @vcmp_ult_v8i16(i16 %n, <8 x i16> %a, <8 x i16> %b) {
122 ; CHECK-LABEL: vcmp_ult_v8i16:
123 ; CHECK: @ %bb.0: @ %entry
124 ; CHECK-NEXT: uxth r0, r0
125 ; CHECK-NEXT: vctp.16 r0
127 ; CHECK-NEXT: vmovt q1, q0
128 ; CHECK-NEXT: vmov q0, q1
131 %i = insertelement <8 x i16> undef, i16 %n, i32 0
132 %ns = shufflevector <8 x i16> %i, <8 x i16> undef, <8 x i32> zeroinitializer
133 %c = icmp ult <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, %ns
134 %s = select <8 x i1> %c, <8 x i16> %a, <8 x i16> %b
138 define arm_aapcs_vfpcc <8 x i16> @vcmp_uge_v8i16(i16 %n, <8 x i16> %a, <8 x i16> %b) {
139 ; CHECK-LABEL: vcmp_uge_v8i16:
140 ; CHECK: @ %bb.0: @ %entry
141 ; CHECK-NEXT: uxth r0, r0
142 ; CHECK-NEXT: vctp.16 r0
144 ; CHECK-NEXT: vmovt q1, q0
145 ; CHECK-NEXT: vmov q0, q1
148 %i = insertelement <8 x i16> undef, i16 %n, i32 0
149 %ns = shufflevector <8 x i16> %i, <8 x i16> undef, <8 x i32> zeroinitializer
150 %c = icmp uge <8 x i16> %ns, <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>
151 %s = select <8 x i1> %c, <8 x i16> %a, <8 x i16> %b
156 define arm_aapcs_vfpcc <16 x i8> @vcmp_ult_v16i8(i8 %n, <16 x i8> %a, <16 x i8> %b) {
157 ; CHECK-LABEL: vcmp_ult_v16i8:
158 ; CHECK: @ %bb.0: @ %entry
159 ; CHECK-NEXT: uxtb r0, r0
160 ; CHECK-NEXT: vctp.8 r0
162 ; CHECK-NEXT: vmovt q1, q0
163 ; CHECK-NEXT: vmov q0, q1
166 %i = insertelement <16 x i8> undef, i8 %n, i32 0
167 %ns = shufflevector <16 x i8> %i, <16 x i8> undef, <16 x i32> zeroinitializer
168 %c = icmp ult <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %ns
169 %s = select <16 x i1> %c, <16 x i8> %a, <16 x i8> %b
173 define arm_aapcs_vfpcc <16 x i8> @vcmp_uge_v16i8(i8 %n, <16 x i8> %a, <16 x i8> %b) {
174 ; CHECK-LABEL: vcmp_uge_v16i8:
175 ; CHECK: @ %bb.0: @ %entry
176 ; CHECK-NEXT: uxtb r0, r0
177 ; CHECK-NEXT: vctp.8 r0
179 ; CHECK-NEXT: vmovt q1, q0
180 ; CHECK-NEXT: vmov q0, q1
183 %i = insertelement <16 x i8> undef, i8 %n, i32 0
184 %ns = shufflevector <16 x i8> %i, <16 x i8> undef, <16 x i32> zeroinitializer
185 %c = icmp uge <16 x i8> %ns, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
186 %s = select <16 x i1> %c, <16 x i8> %a, <16 x i8> %b
191 define arm_aapcs_vfpcc <2 x i64> @vcmp_ult_v2i64(i64 %n, <2 x i64> %a, <2 x i64> %b) {
192 ; CHECK-LABEL: vcmp_ult_v2i64:
193 ; CHECK: @ %bb.0: @ %entry
194 ; CHECK-NEXT: vctp.64 r0
196 ; CHECK-NEXT: vmovt q1, q0
197 ; CHECK-NEXT: vmov q0, q1
200 %i = insertelement <2 x i64> undef, i64 %n, i32 0
201 %ns = shufflevector <2 x i64> %i, <2 x i64> undef, <2 x i32> zeroinitializer
202 %c = icmp ult <2 x i64> <i64 0, i64 1>, %ns
203 %s = select <2 x i1> %c, <2 x i64> %a, <2 x i64> %b
207 define arm_aapcs_vfpcc <2 x i64> @vcmp_uge_v2i64(i64 %n, <2 x i64> %a, <2 x i64> %b) {
208 ; CHECK-LABEL: vcmp_uge_v2i64:
209 ; CHECK: @ %bb.0: @ %entry
210 ; CHECK-NEXT: vctp.64 r0
212 ; CHECK-NEXT: vmovt q1, q0
213 ; CHECK-NEXT: vmov q0, q1
216 %i = insertelement <2 x i64> undef, i64 %n, i32 0
217 %ns = shufflevector <2 x i64> %i, <2 x i64> undef, <2 x i32> zeroinitializer
218 %c = icmp uge <2 x i64> %ns, <i64 0, i64 1>
219 %s = select <2 x i1> %c, <2 x i64> %a, <2 x i64> %b
224 declare <16 x i1> @llvm.arm.mve.vctp8(i32)
225 declare <8 x i1> @llvm.arm.mve.vctp16(i32)
226 declare <4 x i1> @llvm.arm.mve.vctp32(i32)
227 declare <2 x i1> @llvm.arm.mve.vctp64(i32)