xref: /llvm-project/llvm/test/CodeGen/Thumb2/mve-intrinsics/dup.ll (revision fa15255d8af53126bbcb017f2fb6f9961e8574df)
1cf7e98e6SSimon Tatham; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2cf7e98e6SSimon Tatham; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -verify-machineinstrs -o - %s | FileCheck %s
3cf7e98e6SSimon Tatham
4cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x half> @test_vdupq_n_f16(float %a.coerce) {
5cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_f16:
6cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
7*fa15255dSDavid Green; CHECK-NEXT:    vmov r0, s0
8cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.16 q0, r0
9cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
10cf7e98e6SSimon Tathamentry:
11cf7e98e6SSimon Tatham  %0 = bitcast float %a.coerce to i32
12cf7e98e6SSimon Tatham  %tmp.0.extract.trunc = trunc i32 %0 to i16
13cf7e98e6SSimon Tatham  %1 = bitcast i16 %tmp.0.extract.trunc to half
14cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x half> undef, half %1, i32 0
15cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x half> %.splatinsert, <8 x half> undef, <8 x i32> zeroinitializer
16cf7e98e6SSimon Tatham  ret <8 x half> %.splat
17cf7e98e6SSimon Tatham}
18cf7e98e6SSimon Tatham
19cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x float> @test_vdupq_n_f32(float %a) {
20cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_f32:
21cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
22cf7e98e6SSimon Tatham; CHECK-NEXT:    vmov r0, s0
23cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.32 q0, r0
24cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
25cf7e98e6SSimon Tathamentry:
26cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x float> undef, float %a, i32 0
27cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x float> %.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
28cf7e98e6SSimon Tatham  ret <4 x float> %.splat
29cf7e98e6SSimon Tatham}
30cf7e98e6SSimon Tatham
31cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <16 x i8> @test_vdupq_n_s8(i8 signext %a) {
32cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_s8:
33cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
34cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.8 q0, r0
35cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
36cf7e98e6SSimon Tathamentry:
37cf7e98e6SSimon Tatham  %.splatinsert = insertelement <16 x i8> undef, i8 %a, i32 0
38cf7e98e6SSimon Tatham  %.splat = shufflevector <16 x i8> %.splatinsert, <16 x i8> undef, <16 x i32> zeroinitializer
39cf7e98e6SSimon Tatham  ret <16 x i8> %.splat
40cf7e98e6SSimon Tatham}
41cf7e98e6SSimon Tatham
42cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x i16> @test_vdupq_n_s16(i16 signext %a) {
43cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_s16:
44cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
45cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.16 q0, r0
46cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
47cf7e98e6SSimon Tathamentry:
48cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x i16> undef, i16 %a, i32 0
49cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x i16> %.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
50cf7e98e6SSimon Tatham  ret <8 x i16> %.splat
51cf7e98e6SSimon Tatham}
52cf7e98e6SSimon Tatham
53cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x i32> @test_vdupq_n_s32(i32 %a) {
54cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_s32:
55cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
56cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.32 q0, r0
57cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
58cf7e98e6SSimon Tathamentry:
59cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x i32> undef, i32 %a, i32 0
60cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
61cf7e98e6SSimon Tatham  ret <4 x i32> %.splat
62cf7e98e6SSimon Tatham}
63cf7e98e6SSimon Tatham
64cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <16 x i8> @test_vdupq_n_u8(i8 zeroext %a) {
65cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_u8:
66cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
67cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.8 q0, r0
68cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
69cf7e98e6SSimon Tathamentry:
70cf7e98e6SSimon Tatham  %.splatinsert = insertelement <16 x i8> undef, i8 %a, i32 0
71cf7e98e6SSimon Tatham  %.splat = shufflevector <16 x i8> %.splatinsert, <16 x i8> undef, <16 x i32> zeroinitializer
72cf7e98e6SSimon Tatham  ret <16 x i8> %.splat
73cf7e98e6SSimon Tatham}
74cf7e98e6SSimon Tatham
75cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x i16> @test_vdupq_n_u16(i16 zeroext %a) {
76cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_u16:
77cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
78cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.16 q0, r0
79cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
80cf7e98e6SSimon Tathamentry:
81cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x i16> undef, i16 %a, i32 0
82cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x i16> %.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
83cf7e98e6SSimon Tatham  ret <8 x i16> %.splat
84cf7e98e6SSimon Tatham}
85cf7e98e6SSimon Tatham
86cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x i32> @test_vdupq_n_u32(i32 %a) {
87cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_n_u32:
88cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
89cf7e98e6SSimon Tatham; CHECK-NEXT:    vdup.32 q0, r0
90cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
91cf7e98e6SSimon Tathamentry:
92cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x i32> undef, i32 %a, i32 0
93cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
94cf7e98e6SSimon Tatham  ret <4 x i32> %.splat
95cf7e98e6SSimon Tatham}
96cf7e98e6SSimon Tatham
97cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x half> @test_vdupq_m_n_f16(<8 x half> %inactive, float %a.coerce, i16 zeroext %p) {
98cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_f16:
99cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
100*fa15255dSDavid Green; CHECK-NEXT:    vmov r1, s4
101cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r0
102cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
103cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.16 q0, r1
104cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
105cf7e98e6SSimon Tathamentry:
106cf7e98e6SSimon Tatham  %0 = bitcast float %a.coerce to i32
107cf7e98e6SSimon Tatham  %tmp.0.extract.trunc = trunc i32 %0 to i16
108cf7e98e6SSimon Tatham  %1 = bitcast i16 %tmp.0.extract.trunc to half
109cf7e98e6SSimon Tatham  %2 = zext i16 %p to i32
110cf7e98e6SSimon Tatham  %3 = tail call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %2)
111cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x half> undef, half %1, i32 0
112cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x half> %.splatinsert, <8 x half> undef, <8 x i32> zeroinitializer
113cf7e98e6SSimon Tatham  %4 = select <8 x i1> %3, <8 x half> %.splat, <8 x half> %inactive
114cf7e98e6SSimon Tatham  ret <8 x half> %4
115cf7e98e6SSimon Tatham}
116cf7e98e6SSimon Tatham
117cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x float> @test_vdupq_m_n_f32(<4 x float> %inactive, float %a, i16 zeroext %p) {
118cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_f32:
119cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
120b3499f57SDavid Green; CHECK-NEXT:    vmov r1, s4
121cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r0
122cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
123b3499f57SDavid Green; CHECK-NEXT:    vdupt.32 q0, r1
124cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
125cf7e98e6SSimon Tathamentry:
126cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
127cf7e98e6SSimon Tatham  %1 = tail call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
128cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x float> undef, float %a, i32 0
129cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x float> %.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
130cf7e98e6SSimon Tatham  %2 = select <4 x i1> %1, <4 x float> %.splat, <4 x float> %inactive
131cf7e98e6SSimon Tatham  ret <4 x float> %2
132cf7e98e6SSimon Tatham}
133cf7e98e6SSimon Tatham
134cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <16 x i8> @test_vdupq_m_n_s8(<16 x i8> %inactive, i8 signext %a, i16 zeroext %p) {
135cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_s8:
136cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
137cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
138cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
139cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.8 q0, r0
140cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
141cf7e98e6SSimon Tathamentry:
142cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
143cf7e98e6SSimon Tatham  %1 = tail call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
144cf7e98e6SSimon Tatham  %.splatinsert = insertelement <16 x i8> undef, i8 %a, i32 0
145cf7e98e6SSimon Tatham  %.splat = shufflevector <16 x i8> %.splatinsert, <16 x i8> undef, <16 x i32> zeroinitializer
146cf7e98e6SSimon Tatham  %2 = select <16 x i1> %1, <16 x i8> %.splat, <16 x i8> %inactive
147cf7e98e6SSimon Tatham  ret <16 x i8> %2
148cf7e98e6SSimon Tatham}
149cf7e98e6SSimon Tatham
150cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x i16> @test_vdupq_m_n_s16(<8 x i16> %inactive, i16 signext %a, i16 zeroext %p) {
151cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_s16:
152cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
153cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
154cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
155cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.16 q0, r0
156cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
157cf7e98e6SSimon Tathamentry:
158cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
159cf7e98e6SSimon Tatham  %1 = tail call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
160cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x i16> undef, i16 %a, i32 0
161cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x i16> %.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
162cf7e98e6SSimon Tatham  %2 = select <8 x i1> %1, <8 x i16> %.splat, <8 x i16> %inactive
163cf7e98e6SSimon Tatham  ret <8 x i16> %2
164cf7e98e6SSimon Tatham}
165cf7e98e6SSimon Tatham
166cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x i32> @test_vdupq_m_n_s32(<4 x i32> %inactive, i32 %a, i16 zeroext %p) {
167cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_s32:
168cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
169cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
170cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
171cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.32 q0, r0
172cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
173cf7e98e6SSimon Tathamentry:
174cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
175cf7e98e6SSimon Tatham  %1 = tail call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
176cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x i32> undef, i32 %a, i32 0
177cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
178cf7e98e6SSimon Tatham  %2 = select <4 x i1> %1, <4 x i32> %.splat, <4 x i32> %inactive
179cf7e98e6SSimon Tatham  ret <4 x i32> %2
180cf7e98e6SSimon Tatham}
181cf7e98e6SSimon Tatham
182cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <16 x i8> @test_vdupq_m_n_u8(<16 x i8> %inactive, i8 zeroext %a, i16 zeroext %p) {
183cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_u8:
184cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
185cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
186cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
187cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.8 q0, r0
188cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
189cf7e98e6SSimon Tathamentry:
190cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
191cf7e98e6SSimon Tatham  %1 = tail call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
192cf7e98e6SSimon Tatham  %.splatinsert = insertelement <16 x i8> undef, i8 %a, i32 0
193cf7e98e6SSimon Tatham  %.splat = shufflevector <16 x i8> %.splatinsert, <16 x i8> undef, <16 x i32> zeroinitializer
194cf7e98e6SSimon Tatham  %2 = select <16 x i1> %1, <16 x i8> %.splat, <16 x i8> %inactive
195cf7e98e6SSimon Tatham  ret <16 x i8> %2
196cf7e98e6SSimon Tatham}
197cf7e98e6SSimon Tatham
198cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <8 x i16> @test_vdupq_m_n_u16(<8 x i16> %inactive, i16 zeroext %a, i16 zeroext %p) {
199cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_u16:
200cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
201cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
202cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
203cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.16 q0, r0
204cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
205cf7e98e6SSimon Tathamentry:
206cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
207cf7e98e6SSimon Tatham  %1 = tail call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
208cf7e98e6SSimon Tatham  %.splatinsert = insertelement <8 x i16> undef, i16 %a, i32 0
209cf7e98e6SSimon Tatham  %.splat = shufflevector <8 x i16> %.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
210cf7e98e6SSimon Tatham  %2 = select <8 x i1> %1, <8 x i16> %.splat, <8 x i16> %inactive
211cf7e98e6SSimon Tatham  ret <8 x i16> %2
212cf7e98e6SSimon Tatham}
213cf7e98e6SSimon Tatham
214cf7e98e6SSimon Tathamdefine arm_aapcs_vfpcc <4 x i32> @test_vdupq_m_n_u32(<4 x i32> %inactive, i32 %a, i16 zeroext %p) {
215cf7e98e6SSimon Tatham; CHECK-LABEL: test_vdupq_m_n_u32:
216cf7e98e6SSimon Tatham; CHECK:       @ %bb.0: @ %entry
217cf7e98e6SSimon Tatham; CHECK-NEXT:    vmsr p0, r1
218cf7e98e6SSimon Tatham; CHECK-NEXT:    vpst
219cf7e98e6SSimon Tatham; CHECK-NEXT:    vdupt.32 q0, r0
220cf7e98e6SSimon Tatham; CHECK-NEXT:    bx lr
221cf7e98e6SSimon Tathamentry:
222cf7e98e6SSimon Tatham  %0 = zext i16 %p to i32
223cf7e98e6SSimon Tatham  %1 = tail call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
224cf7e98e6SSimon Tatham  %.splatinsert = insertelement <4 x i32> undef, i32 %a, i32 0
225cf7e98e6SSimon Tatham  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
226cf7e98e6SSimon Tatham  %2 = select <4 x i1> %1, <4 x i32> %.splat, <4 x i32> %inactive
227cf7e98e6SSimon Tatham  ret <4 x i32> %2
228cf7e98e6SSimon Tatham}
229cf7e98e6SSimon Tatham
230cf7e98e6SSimon Tathamdeclare <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32)
231cf7e98e6SSimon Tathamdeclare <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32)
232cf7e98e6SSimon Tathamdeclare <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32)
233