2 # RUN: llc -O0 -mattr=-fullfp16 -mtriple=aarch64-- \
3 # RUN: -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
6 define <2 x double> @test_v2s64_unmerge(<2 x double> %a) {
10 define <4 x float> @test_v4s32_unmerge(<4 x float> %a) {
14 define <4 x half> @test_v4s16_unmerge(<4 x half> %a) {
18 define <8 x half> @test_v8s16_unmerge(<8 x half> %a) {
24 name: test_v2s64_unmerge
28 tracksRegLiveness: true
30 - { id: 0, class: fpr }
31 - { id: 1, class: fpr }
32 - { id: 2, class: fpr }
33 - { id: 3, class: fpr }
37 ; CHECK-LABEL: name: test_v2s64_unmerge
38 %0:fpr(<2 x s64>) = COPY $q0
40 ; Since 2 * 64 = 128, we can just directly copy.
41 ; CHECK: %2:fpr64 = COPY %0.dsub
42 ; CHECK: %3:fpr64 = CPYi64 %0, 1
43 %2:fpr(s64), %3:fpr(s64) = G_UNMERGE_VALUES %0(<2 x s64>)
45 %1:fpr(<2 x s64>) = G_BUILD_VECTOR %2(s64), %3(s64)
46 $q0 = COPY %1(<2 x s64>)
47 RET_ReallyLR implicit $q0
50 name: test_v4s32_unmerge
54 tracksRegLiveness: true
56 - { id: 0, class: fpr }
57 - { id: 1, class: fpr }
58 - { id: 2, class: fpr }
59 - { id: 3, class: fpr }
60 - { id: 4, class: fpr }
61 - { id: 5, class: fpr }
65 ; CHECK-LABEL: name: test_v4s32_unmerge
66 %0:fpr(<4 x s32>) = COPY $q0
68 ; Since 4 * 32 = 128, we can just directly copy.
69 ; CHECK: %2:fpr32 = COPY %0.ssub
70 ; CHECK: %3:fpr32 = CPYi32 %0, 1
71 ; CHECK: %4:fpr32 = CPYi32 %0, 2
72 ; CHECK: %5:fpr32 = CPYi32 %0, 3
73 %2:fpr(s32), %3:fpr(s32), %4:fpr(s32), %5:fpr(s32) = G_UNMERGE_VALUES %0(<4 x s32>)
75 %1:fpr(<4 x s32>) = G_BUILD_VECTOR %2(s32), %3(s32), %4(s32), %5(s32)
76 $q0 = COPY %1(<4 x s32>)
77 RET_ReallyLR implicit $q0
80 name: test_v4s16_unmerge
84 tracksRegLiveness: true
86 - { id: 0, class: fpr }
87 - { id: 1, class: fpr }
88 - { id: 2, class: fpr }
89 - { id: 3, class: fpr }
90 - { id: 4, class: fpr }
91 - { id: 5, class: fpr }
95 ; CHECK-LABEL: name: test_v4s16_unmerge
96 %0:fpr(<4 x s16>) = COPY $d0
98 ; Since 4 * 16 != 128, we need to widen using implicit defs.
99 ; Note that we expect to reuse one of the INSERT_SUBREG results, as CPYi16
100 ; expects a lane > 0.
101 ; CHECK-DAG: [[IMPDEF1:%[0-9]+]]:fpr128 = IMPLICIT_DEF
102 ; CHECK-NEXT: [[INS_SHARED:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF1]], %0, %subreg.dsub
103 ; CHECK: [[IMPDEF2:%[0-9]+]]:fpr128 = IMPLICIT_DEF
104 ; CHECK-NEXT: [[INS2:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF2]], %0, %subreg.dsub
105 ; CHECK: [[IMPDEF3:%[0-9]+]]:fpr128 = IMPLICIT_DEF
106 ; CHECK-NEXT: [[INS3:%[0-9]+]]:fpr128 = INSERT_SUBREG [[IMPDEF3]], %0, %subreg.dsub
107 ; CHECK: %2:fpr16 = COPY [[INS_SHARED]].hsub
108 ; CHECK: %3:fpr16 = CPYi16 [[INS_SHARED]], 1
109 ; CHECK: %4:fpr16 = CPYi16 [[INS2]], 2
110 ; CHECK: %5:fpr16 = CPYi16 [[INS3]], 3
111 %2:fpr(s16), %3:fpr(s16), %4:fpr(s16), %5:fpr(s16) = G_UNMERGE_VALUES %0(<4 x s16>)
113 %1:fpr(<4 x s16>) = G_BUILD_VECTOR %2(s16), %3(s16), %4(s16), %5(s16)
114 $d0 = COPY %1(<4 x s16>)
115 RET_ReallyLR implicit $d0
118 name: test_v8s16_unmerge
121 regBankSelected: true
122 tracksRegLiveness: true
124 - { id: 0, class: fpr }
125 - { id: 1, class: fpr }
126 - { id: 2, class: fpr }
127 - { id: 3, class: fpr }
128 - { id: 4, class: fpr }
129 - { id: 5, class: fpr }
130 - { id: 6, class: fpr }
131 - { id: 7, class: fpr }
132 - { id: 8, class: fpr }
133 - { id: 9, class: fpr }
137 ; CHECK-LABEL: name: test_v8s16_unmerge
138 %0:fpr(<8 x s16>) = COPY $q0
140 ; Since 8 * 16 = 128, we can just directly copy.
141 ; CHECK: %2:fpr16 = COPY %0.hsub
142 ; CHECK: %3:fpr16 = CPYi16 %0, 1
143 ; CHECK: %4:fpr16 = CPYi16 %0, 2
144 ; CHECK: %5:fpr16 = CPYi16 %0, 3
145 ; CHECK: %6:fpr16 = CPYi16 %0, 4
146 ; CHECK: %7:fpr16 = CPYi16 %0, 5
147 ; CHECK: %8:fpr16 = CPYi16 %0, 6
148 ; CHECK: %9:fpr16 = CPYi16 %0, 7
149 %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>)
151 %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)
152 $q0 = COPY %1(<8 x s16>)
153 RET_ReallyLR implicit $q0