1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: opt -instcombine -mtriple=thumbv8.1m.main %s | llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -verify-machineinstrs -o - | FileCheck %s
4 declare <16 x i1> @llvm.arm.mve.vctp8(i32)
5 declare <8 x i1> @llvm.arm.mve.vctp16(i32)
6 declare <4 x i1> @llvm.arm.mve.vctp32(i32)
7 declare <4 x i1> @llvm.arm.mve.vctp64(i32)
9 declare i32 @llvm.arm.mve.pred.v2i.v4i1(<4 x i1>)
10 declare i32 @llvm.arm.mve.pred.v2i.v8i1(<8 x i1>)
11 declare i32 @llvm.arm.mve.pred.v2i.v16i1(<16 x i1>)
13 declare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
14 declare <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32)
15 declare <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32)
17 define arm_aapcs_vfpcc zeroext i16 @test_vctp8q(i32 %a) {
18 ; CHECK-LABEL: test_vctp8q:
19 ; CHECK: @ %bb.0: @ %entry
20 ; CHECK-NEXT: vctp.8 r0
21 ; CHECK-NEXT: vmrs r0, p0
24 %0 = call <16 x i1> @llvm.arm.mve.vctp8(i32 %a)
25 %1 = call i32 @llvm.arm.mve.pred.v2i.v16i1(<16 x i1> %0)
26 %2 = trunc i32 %1 to i16
30 define arm_aapcs_vfpcc zeroext i16 @test_vctp8q_m(i32 %a, i16 zeroext %p) {
31 ; CHECK-LABEL: test_vctp8q_m:
32 ; CHECK: @ %bb.0: @ %entry
33 ; CHECK-NEXT: vmsr p0, r1
35 ; CHECK-NEXT: vctpt.8 r0
36 ; CHECK-NEXT: vmrs r0, p0
39 %0 = zext i16 %p to i32
40 %1 = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
41 %2 = call <16 x i1> @llvm.arm.mve.vctp8(i32 %a)
42 %3 = and <16 x i1> %1, %2
43 %4 = call i32 @llvm.arm.mve.pred.v2i.v16i1(<16 x i1> %3)
44 %5 = trunc i32 %4 to i16
48 define arm_aapcs_vfpcc zeroext i16 @test_vctp16q(i32 %a) {
49 ; CHECK-LABEL: test_vctp16q:
50 ; CHECK: @ %bb.0: @ %entry
51 ; CHECK-NEXT: vctp.16 r0
52 ; CHECK-NEXT: vmrs r0, p0
55 %0 = call <8 x i1> @llvm.arm.mve.vctp16(i32 %a)
56 %1 = call i32 @llvm.arm.mve.pred.v2i.v8i1(<8 x i1> %0)
57 %2 = trunc i32 %1 to i16
61 define arm_aapcs_vfpcc zeroext i16 @test_vctp16q_m(i32 %a, i16 zeroext %p) {
62 ; CHECK-LABEL: test_vctp16q_m:
63 ; CHECK: @ %bb.0: @ %entry
64 ; CHECK-NEXT: vmsr p0, r1
66 ; CHECK-NEXT: vctpt.16 r0
67 ; CHECK-NEXT: vmrs r0, p0
70 %0 = zext i16 %p to i32
71 %1 = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
72 %2 = call <8 x i1> @llvm.arm.mve.vctp16(i32 %a)
73 %3 = and <8 x i1> %1, %2
74 %4 = call i32 @llvm.arm.mve.pred.v2i.v8i1(<8 x i1> %3)
75 %5 = trunc i32 %4 to i16
79 define arm_aapcs_vfpcc zeroext i16 @test_vctp32q(i32 %a) {
80 ; CHECK-LABEL: test_vctp32q:
81 ; CHECK: @ %bb.0: @ %entry
82 ; CHECK-NEXT: vctp.32 r0
83 ; CHECK-NEXT: vmrs r0, p0
86 %0 = call <4 x i1> @llvm.arm.mve.vctp32(i32 %a)
87 %1 = call i32 @llvm.arm.mve.pred.v2i.v4i1(<4 x i1> %0)
88 %2 = trunc i32 %1 to i16
92 define arm_aapcs_vfpcc zeroext i16 @test_vctp32q_m(i32 %a, i16 zeroext %p) {
93 ; CHECK-LABEL: test_vctp32q_m:
94 ; CHECK: @ %bb.0: @ %entry
95 ; CHECK-NEXT: vmsr p0, r1
97 ; CHECK-NEXT: vctpt.32 r0
98 ; CHECK-NEXT: vmrs r0, p0
101 %0 = zext i16 %p to i32
102 %1 = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
103 %2 = call <4 x i1> @llvm.arm.mve.vctp32(i32 %a)
104 %3 = and <4 x i1> %1, %2
105 %4 = call i32 @llvm.arm.mve.pred.v2i.v4i1(<4 x i1> %3)
106 %5 = trunc i32 %4 to i16
110 define arm_aapcs_vfpcc zeroext i16 @test_vctp64q(i32 %a) {
111 ; CHECK-LABEL: test_vctp64q:
112 ; CHECK: @ %bb.0: @ %entry
113 ; CHECK-NEXT: vctp.64 r0
114 ; CHECK-NEXT: vmrs r0, p0
117 %0 = call <4 x i1> @llvm.arm.mve.vctp64(i32 %a)
118 %1 = call i32 @llvm.arm.mve.pred.v2i.v4i1(<4 x i1> %0)
119 %2 = trunc i32 %1 to i16
123 define arm_aapcs_vfpcc zeroext i16 @test_vctp64q_m(i32 %a, i16 zeroext %p) {
124 ; CHECK-LABEL: test_vctp64q_m:
125 ; CHECK: @ %bb.0: @ %entry
126 ; CHECK-NEXT: vmsr p0, r1
128 ; CHECK-NEXT: vctpt.64 r0
129 ; CHECK-NEXT: vmrs r0, p0
132 %0 = zext i16 %p to i32
133 %1 = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
134 %2 = call <4 x i1> @llvm.arm.mve.vctp64(i32 %a)
135 %3 = and <4 x i1> %1, %2
136 %4 = call i32 @llvm.arm.mve.pred.v2i.v4i1(<4 x i1> %3)
137 %5 = trunc i32 %4 to i16
141 define arm_aapcs_vfpcc <16 x i8> @test_vpselq_i8(<16 x i8> %a, <16 x i8> %b, i16 zeroext %p) #2 {
142 ; CHECK-LABEL: test_vpselq_i8:
143 ; CHECK: @ %bb.0: @ %entry
144 ; CHECK-NEXT: vmsr p0, r0
145 ; CHECK-NEXT: vpsel q0, q0, q1
148 %0 = zext i16 %p to i32
149 %1 = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
150 %2 = select <16 x i1> %1, <16 x i8> %a, <16 x i8> %b
154 define arm_aapcs_vfpcc <8 x i16> @test_vpselq_i16(<8 x i16> %a, <8 x i16> %b, i16 zeroext %p) #2 {
155 ; CHECK-LABEL: test_vpselq_i16:
156 ; CHECK: @ %bb.0: @ %entry
157 ; CHECK-NEXT: vmsr p0, r0
158 ; CHECK-NEXT: vpsel q0, q0, q1
161 %0 = zext i16 %p to i32
162 %1 = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
163 %2 = select <8 x i1> %1, <8 x i16> %a, <8 x i16> %b
167 define arm_aapcs_vfpcc <8 x half> @test_vpselq_f16(<8 x half> %a, <8 x half> %b, i16 zeroext %p) #2 {
168 ; CHECK-LABEL: test_vpselq_f16:
169 ; CHECK: @ %bb.0: @ %entry
170 ; CHECK-NEXT: vmsr p0, r0
171 ; CHECK-NEXT: vpsel q0, q0, q1
174 %0 = zext i16 %p to i32
175 %1 = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
176 %2 = select <8 x i1> %1, <8 x half> %a, <8 x half> %b
180 define arm_aapcs_vfpcc <4 x i32> @test_vpselq_i32(<4 x i32> %a, <4 x i32> %b, i16 zeroext %p) #2 {
181 ; CHECK-LABEL: test_vpselq_i32:
182 ; CHECK: @ %bb.0: @ %entry
183 ; CHECK-NEXT: vmsr p0, r0
184 ; CHECK-NEXT: vpsel q0, q0, q1
187 %0 = zext i16 %p to i32
188 %1 = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
189 %2 = select <4 x i1> %1, <4 x i32> %a, <4 x i32> %b
193 define arm_aapcs_vfpcc <4 x float> @test_vpselq_f32(<4 x float> %a, <4 x float> %b, i16 zeroext %p) #2 {
194 ; CHECK-LABEL: test_vpselq_f32:
195 ; CHECK: @ %bb.0: @ %entry
196 ; CHECK-NEXT: vmsr p0, r0
197 ; CHECK-NEXT: vpsel q0, q0, q1
200 %0 = zext i16 %p to i32
201 %1 = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
202 %2 = select <4 x i1> %1, <4 x float> %a, <4 x float> %b
206 define arm_aapcs_vfpcc <2 x i64> @test_vpselq_i64(<2 x i64> %a, <2 x i64> %b, i16 zeroext %p) #2 {
207 ; CHECK-LABEL: test_vpselq_i64:
208 ; CHECK: @ %bb.0: @ %entry
209 ; CHECK-NEXT: vmsr p0, r0
210 ; CHECK-NEXT: vpsel q0, q0, q1
213 %0 = zext i16 %p to i32
214 %1 = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
215 %2 = bitcast <2 x i64> %a to <4 x i32>
216 %3 = bitcast <2 x i64> %b to <4 x i32>
217 %4 = select <4 x i1> %1, <4 x i32> %2, <4 x i32> %3
218 %5 = bitcast <4 x i32> %4 to <2 x i64>