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
19 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
20 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
21 ; CHECK: [[UZP1_:%[0-9]+]]:_(<4 x s32>) = G_UZP1 [[COPY]], [[COPY1]]
22 ; CHECK: $q0 = COPY [[UZP1_]](<4 x s32>)
23 ; CHECK: RET_ReallyLR implicit $q0
24 %0:_(<4 x s32>) = COPY $q0
25 %1:_(<4 x s32>) = COPY $q1
26 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, 2, 4, 6)
27 $q0 = COPY %2(<4 x s32>)
28 RET_ReallyLR implicit $q0
34 tracksRegLiveness: true
39 ; CHECK-LABEL: name: uzp2_v4s32
40 ; CHECK: liveins: $q0, $q1
41 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
42 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
43 ; CHECK: [[UZP2_:%[0-9]+]]:_(<4 x s32>) = G_UZP2 [[COPY]], [[UZP2_]]
44 ; CHECK: $q0 = COPY [[UZP2_]](<4 x s32>)
45 ; CHECK: RET_ReallyLR implicit $q0
46 %0:_(<4 x s32>) = COPY $q0
47 %1:_(<4 x s32>) = COPY $q1
48 %1:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 3, 5, 7)
49 $q0 = COPY %1(<4 x s32>)
50 RET_ReallyLR implicit $q0
56 tracksRegLiveness: true
61 ; See isUZPMask: Mask[1] != 2 * i + 0
63 ; CHECK-LABEL: name: no_uzp1
64 ; CHECK: liveins: $q0, $q1
65 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
66 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
67 ; CHECK: [[SHUF:%[0-9]+]]:_(<4 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(0, 1, 4, 6)
68 ; CHECK: $q0 = COPY [[SHUF]](<4 x s32>)
69 ; CHECK: RET_ReallyLR implicit $q0
70 %0:_(<4 x s32>) = COPY $q0
71 %1:_(<4 x s32>) = COPY $q1
72 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, 1, 4, 6)
73 $q0 = COPY %2(<4 x s32>)
74 RET_ReallyLR implicit $q0
80 tracksRegLiveness: true
85 ; See isUZPMask: Mask[1] != 2 * i + 1
87 ; CHECK-LABEL: name: no_uzp2
88 ; CHECK: liveins: $q0, $q1
89 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
90 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
91 ; CHECK: [[SHUF:%[0-9]+]]:_(<4 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(1, 4, 5, 7)
92 ; CHECK: $q0 = COPY [[SHUF]](<4 x s32>)
93 ; CHECK: RET_ReallyLR implicit $q0
94 %0:_(<4 x s32>) = COPY $q0
95 %1:_(<4 x s32>) = COPY $q1
96 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 4, 5, 7)
97 $q0 = COPY %2(<4 x s32>)
98 RET_ReallyLR implicit $q0
104 tracksRegLiveness: true
109 ; Make sure that we can still produce a uzp1/uzp2 with undef indices.
111 ; CHECK-LABEL: name: uzp1_undef
112 ; CHECK: liveins: $q0, $q1
113 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
114 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
115 ; CHECK: [[UZP1_:%[0-9]+]]:_(<4 x s32>) = G_UZP1 [[COPY]], [[COPY1]]
116 ; CHECK: $q0 = COPY [[UZP1_]](<4 x s32>)
117 ; CHECK: RET_ReallyLR implicit $q0
118 %0:_(<4 x s32>) = COPY $q0
119 %1:_(<4 x s32>) = COPY $q1
120 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(0, -1, 4, 6)
121 $q0 = COPY %2(<4 x s32>)
122 RET_ReallyLR implicit $q0
128 tracksRegLiveness: true
133 ; Make sure that we can still produce a uzp1/uzp2 with undef indices.
135 ; CHECK-LABEL: name: uzp2_undef
136 ; CHECK: liveins: $q0, $q1
137 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
138 ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
139 ; CHECK: [[UZP2_:%[0-9]+]]:_(<4 x s32>) = G_UZP2 [[COPY]], [[UZP2_]]
140 ; CHECK: $q0 = COPY [[UZP2_]](<4 x s32>)
141 ; CHECK: RET_ReallyLR implicit $q0
142 %0:_(<4 x s32>) = COPY $q0
143 %1:_(<4 x s32>) = COPY $q1
144 %1:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1, shufflemask(1, 3, -1, 7)
145 $q0 = COPY %1(<4 x s32>)
146 RET_ReallyLR implicit $q0