1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
3 # Check that we can recognize a shuffle mask for a uzp instruction and produce
4 # a G_UZP1 or G_UZP2 where appropriate.
6 # RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-lowering -verify-machineinstrs %s -o - | FileCheck %s
12 tracksRegLiveness: true
17 ; CHECK-LABEL: name: uzp1_v4s32
18 ; CHECK: liveins: $q0, $q1
20 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
21 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
22 ; CHECK-NEXT: [[UZP1_:%[0-9]+]]:_(<4 x s32>) = G_UZP1 [[COPY]], [[COPY1]]
23 ; CHECK-NEXT: $q0 = COPY [[UZP1_]](<4 x s32>)
24 ; CHECK-NEXT: RET_ReallyLR implicit $q0
25 %0:_(<4 x s32>) = COPY $q0
26 %1:_(<4 x s32>) = COPY $q1
27 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, 2, 4, 6)
28 $q0 = COPY %2(<4 x s32>)
29 RET_ReallyLR implicit $q0
35 tracksRegLiveness: true
40 ; CHECK-LABEL: name: uzp2_v4s32
41 ; CHECK: liveins: $q0, $q1
43 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
44 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
45 ; CHECK-NEXT: [[UZP2_:%[0-9]+]]:_(<4 x s32>) = G_UZP2 [[COPY]], [[COPY1]]
46 ; CHECK-NEXT: $q0 = COPY [[UZP2_]](<4 x s32>)
47 ; CHECK-NEXT: RET_ReallyLR implicit $q0
48 %0:_(<4 x s32>) = COPY $q0
49 %1:_(<4 x s32>) = COPY $q1
50 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 3, 5, 7)
51 $q0 = COPY %2(<4 x s32>)
52 RET_ReallyLR implicit $q0
58 tracksRegLiveness: true
63 ; See isUZPMask: Mask[1] != 2 * i + 0
65 ; CHECK-LABEL: name: no_uzp1
66 ; CHECK: liveins: $q0, $q1
68 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
69 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
70 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<4 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(0, 1, 4, 6)
71 ; CHECK-NEXT: $q0 = COPY [[SHUF]](<4 x s32>)
72 ; CHECK-NEXT: RET_ReallyLR implicit $q0
73 %0:_(<4 x s32>) = COPY $q0
74 %1:_(<4 x s32>) = COPY $q1
75 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, 1, 4, 6)
76 $q0 = COPY %2(<4 x s32>)
77 RET_ReallyLR implicit $q0
83 tracksRegLiveness: true
88 ; See isUZPMask: Mask[1] != 2 * i + 1
90 ; CHECK-LABEL: name: no_uzp2
91 ; CHECK: liveins: $q0, $q1
93 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
94 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
95 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<4 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(1, 4, 5, 7)
96 ; CHECK-NEXT: $q0 = COPY [[SHUF]](<4 x s32>)
97 ; CHECK-NEXT: RET_ReallyLR implicit $q0
98 %0:_(<4 x s32>) = COPY $q0
99 %1:_(<4 x s32>) = COPY $q1
100 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 4, 5, 7)
101 $q0 = COPY %2(<4 x s32>)
102 RET_ReallyLR implicit $q0
108 tracksRegLiveness: true
113 ; Make sure that we can still produce a uzp1/uzp2 with undef indices.
115 ; CHECK-LABEL: name: uzp1_undef
116 ; CHECK: liveins: $q0, $q1
118 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
119 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
120 ; CHECK-NEXT: [[UZP1_:%[0-9]+]]:_(<4 x s32>) = G_UZP1 [[COPY]], [[COPY1]]
121 ; CHECK-NEXT: $q0 = COPY [[UZP1_]](<4 x s32>)
122 ; CHECK-NEXT: RET_ReallyLR implicit $q0
123 %0:_(<4 x s32>) = COPY $q0
124 %1:_(<4 x s32>) = COPY $q1
125 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, -1, 4, 6)
126 $q0 = COPY %2(<4 x s32>)
127 RET_ReallyLR implicit $q0
133 tracksRegLiveness: true
138 ; Make sure that we can still produce a uzp1/uzp2 with undef indices.
140 ; CHECK-LABEL: name: uzp2_undef
141 ; CHECK: liveins: $q0, $q1
143 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
144 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
145 ; CHECK-NEXT: [[UZP2_:%[0-9]+]]:_(<4 x s32>) = G_UZP2 [[COPY]], [[COPY1]]
146 ; CHECK-NEXT: $q0 = COPY [[UZP2_]](<4 x s32>)
147 ; CHECK-NEXT: RET_ReallyLR implicit $q0
148 %0:_(<4 x s32>) = COPY $q0
149 %1:_(<4 x s32>) = COPY $q1
150 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 3, -1, 7)
151 $q0 = COPY %2(<4 x s32>)
152 RET_ReallyLR implicit $q0