[ARM] MVE big endian bitcasts
[llvm-complete.git] / test / CodeGen / AArch64 / GlobalISel / select-unmerge.mir
blobfdc5f12912be8a5675aa8a4895bdfa87a857776d
2 # RUN: llc -O0 -mattr=-fullfp16 -mtriple=aarch64-- \
3 # RUN: -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 --- |
6   define <2 x double> @test_v2s64_unmerge(<2 x double> %a) {
7     ret <2 x double> %a
8   }
10   define <4 x float> @test_v4s32_unmerge(<4 x float> %a) {
11     ret <4 x float> %a
12   }
14   define <4 x half> @test_v4s16_unmerge(<4 x half> %a) {
15     ret <4 x half> %a
16   }
18   define <8 x half> @test_v8s16_unmerge(<8 x half> %a) {
19     ret <8 x half> %a
20   }
22   define <2 x float> @test_vecsplit_2v2s32_v4s32(<4 x float> %a) {
23     ret <2 x float> undef
24   }
26   define <2 x half> @test_vecsplit_2v2s16_v4s16(<4 x half> %a) {
27     ret <2 x half> undef
28   }
30 ...
31 ---
32 name:            test_v2s64_unmerge
33 alignment:       2
34 legalized:       true
35 regBankSelected: true
36 tracksRegLiveness: true
37 registers:
38   - { id: 0, class: fpr }
39   - { id: 1, class: fpr }
40   - { id: 2, class: fpr }
41   - { id: 3, class: fpr }
42 body:             |
43   bb.1 (%ir-block.0):
44     liveins: $q0
45     ; CHECK-LABEL: name:            test_v2s64_unmerge
46     %0:fpr(<2 x s64>) = COPY $q0
48     ; Since 2 * 64 = 128, we can just directly copy.
49     ; CHECK: %2:fpr64 = COPY %0.dsub
50     ; CHECK: %3:fpr64 = CPYi64 %0, 1
51     %2:fpr(s64), %3:fpr(s64) = G_UNMERGE_VALUES %0(<2 x s64>)
53     %1:fpr(<2 x s64>) = G_BUILD_VECTOR %2(s64), %3(s64)
54     $q0 = COPY %1(<2 x s64>)
55     RET_ReallyLR implicit $q0
56 ...
57 ---
58 name:            test_v4s32_unmerge
59 alignment:       2
60 legalized:       true
61 regBankSelected: true
62 tracksRegLiveness: true
63 registers:
64   - { id: 0, class: fpr }
65   - { id: 1, class: fpr }
66   - { id: 2, class: fpr }
67   - { id: 3, class: fpr }
68   - { id: 4, class: fpr }
69   - { id: 5, class: fpr }
70 body:             |
71   bb.1 (%ir-block.0):
72     liveins: $q0
73     ; CHECK-LABEL: name:            test_v4s32_unmerge
74     %0:fpr(<4 x s32>) = COPY $q0
76     ; Since 4 * 32 = 128, we can just directly copy.
77     ; CHECK: %2:fpr32 = COPY %0.ssub
78     ; CHECK: %3:fpr32 = CPYi32 %0, 1
79     ; CHECK: %4:fpr32 = CPYi32 %0, 2
80     ; CHECK: %5:fpr32 = CPYi32 %0, 3
81     %2:fpr(s32), %3:fpr(s32), %4:fpr(s32), %5:fpr(s32) = G_UNMERGE_VALUES %0(<4 x s32>)
83     %1:fpr(<4 x s32>) = G_BUILD_VECTOR %2(s32), %3(s32), %4(s32), %5(s32)
84     $q0 = COPY %1(<4 x s32>)
85     RET_ReallyLR implicit $q0
86 ...
87 ---
88 name:            test_v4s16_unmerge
89 alignment:       2
90 legalized:       true
91 regBankSelected: true
92 tracksRegLiveness: true
93 registers:
94   - { id: 0, class: fpr }
95   - { id: 1, class: fpr }
96   - { id: 2, class: fpr }
97   - { id: 3, class: fpr }
98   - { id: 4, class: fpr }
99   - { id: 5, class: fpr }
100 body:             |
101   bb.1 (%ir-block.0):
102     liveins: $d0
103     ; CHECK-LABEL: name:            test_v4s16_unmerge
104     %0:fpr(<4 x s16>) = COPY $d0
106     ; Since 4 * 16 != 128, we need to widen using implicit defs.
107     ; Note that we expect to reuse one of the INSERT_SUBREG results, as CPYi16
108     ; expects a lane > 0.
109     ; CHECK-DAG: [[IMPDEF1:%[0-9]+]]:fpr128 = IMPLICIT_DEF
110     ; CHECK-NEXT: [[INS_SHARED:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF1]], %0, %subreg.dsub
111     ; CHECK: [[IMPDEF2:%[0-9]+]]:fpr128 = IMPLICIT_DEF
112     ; CHECK-NEXT: [[INS2:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF2]], %0, %subreg.dsub
113     ; CHECK: [[IMPDEF3:%[0-9]+]]:fpr128 = IMPLICIT_DEF
114     ; CHECK-NEXT: [[INS3:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF3]], %0, %subreg.dsub
115     ; CHECK: %2:fpr16 = COPY [[INS_SHARED]].hsub
116     ; CHECK: %3:fpr16 = CPYi16 [[INS_SHARED]], 1
117     ; CHECK: %4:fpr16 = CPYi16 [[INS2]], 2
118     ; CHECK: %5:fpr16 = CPYi16 [[INS3]], 3
119     %2:fpr(s16), %3:fpr(s16), %4:fpr(s16), %5:fpr(s16) = G_UNMERGE_VALUES %0(<4 x s16>)
121     %1:fpr(<4 x s16>) = G_BUILD_VECTOR %2(s16), %3(s16), %4(s16), %5(s16)
122     $d0 = COPY %1(<4 x s16>)
123     RET_ReallyLR implicit $d0
126 name:            test_v8s16_unmerge
127 alignment:       2
128 legalized:       true
129 regBankSelected: true
130 tracksRegLiveness: true
131 registers:
132   - { id: 0, class: fpr }
133   - { id: 1, class: fpr }
134   - { id: 2, class: fpr }
135   - { id: 3, class: fpr }
136   - { id: 4, class: fpr }
137   - { id: 5, class: fpr }
138   - { id: 6, class: fpr }
139   - { id: 7, class: fpr }
140   - { id: 8, class: fpr }
141   - { id: 9, class: fpr }
142 body:             |
143   bb.1 (%ir-block.0):
144     liveins: $q0
145     ; CHECK-LABEL: name:            test_v8s16_unmerge
146     %0:fpr(<8 x s16>) = COPY $q0
148     ; Since 8 * 16 = 128, we can just directly copy.
149     ; CHECK: %2:fpr16 = COPY %0.hsub
150     ; CHECK: %3:fpr16 = CPYi16 %0, 1
151     ; CHECK: %4:fpr16 = CPYi16 %0, 2
152     ; CHECK: %5:fpr16 = CPYi16 %0, 3
153     ; CHECK: %6:fpr16 = CPYi16 %0, 4
154     ; CHECK: %7:fpr16 = CPYi16 %0, 5
155     ; CHECK: %8:fpr16 = CPYi16 %0, 6
156     ; CHECK: %9:fpr16 = CPYi16 %0, 7
157     %2:fpr(s16), %3:fpr(s16), %4:fpr(s16), %5:fpr(s16), %6:fpr(s16), %7:fpr(s16), %8:fpr(s16), %9:fpr(s16) = G_UNMERGE_VALUES %0(<8 x s16>)
159     %1:fpr(<8 x s16>) = G_BUILD_VECTOR %2:fpr(s16), %3:fpr(s16), %4:fpr(s16), %5:fpr(s16), %6:fpr(s16), %7:fpr(s16), %8:fpr(s16), %9:fpr(s16)
160     $q0 = COPY %1(<8 x s16>)
161     RET_ReallyLR implicit $q0
164 name:            test_vecsplit_2v2s32_v4s32
165 alignment:       2
166 legalized:       true
167 regBankSelected: true
168 tracksRegLiveness: true
169 body:             |
170   bb.1 (%ir-block.0):
171     liveins: $q0
172     ; CHECK-LABEL: name: test_vecsplit_2v2s32_v4s32
173     ; CHECK: liveins: $q0
174     ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
175     ; CHECK: [[COPY1:%[0-9]+]]:fpr64 = COPY [[COPY]].dsub
176     ; CHECK: [[CPYi64_:%[0-9]+]]:fpr64 = CPYi64 [[COPY]], 1
177     ; CHECK: $d0 = COPY [[COPY1]]
178     ; CHECK: $d1 = COPY [[CPYi64_]]
179     ; CHECK: RET_ReallyLR implicit $d0
180     %0:fpr(<4 x s32>) = COPY $q0
181     %1:fpr(<2 x s32>), %2:fpr(<2 x s32>) = G_UNMERGE_VALUES %0(<4 x s32>)
182     $d0 = COPY %1(<2 x s32>)
183     $d1 = COPY %2(<2 x s32>)
184     RET_ReallyLR implicit $d0
187 name:            test_vecsplit_2v2s16_v4s16
188 alignment:       2
189 legalized:       true
190 regBankSelected: true
191 tracksRegLiveness: true
192 body:             |
193   bb.1 (%ir-block.0):
194     liveins: $d0
195     ; CHECK-LABEL: name: test_vecsplit_2v2s16_v4s16
196     ; CHECK: liveins: $d0
197     ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
198     ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY [[COPY]].ssub
199     ; CHECK: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
200     ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.dsub
201     ; CHECK: [[CPYi32_:%[0-9]+]]:fpr32 = CPYi32 [[INSERT_SUBREG]], 1
202     ; CHECK: $s0 = COPY [[COPY1]]
203     ; CHECK: $s1 = COPY [[CPYi32_]]
204     ; CHECK: RET_ReallyLR implicit $s0
205     %0:fpr(<4 x s16>) = COPY $d0
206     %1:fpr(<2 x s16>), %2:fpr(<2 x s16>) = G_UNMERGE_VALUES %0(<4 x s16>)
207     $s0 = COPY %1(<2 x s16>)
208     $s1 = COPY %2(<2 x s16>)
209     RET_ReallyLR implicit $s0