1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# 3# Check that we can recognize a shuffle mask for a uzp instruction and produce 4# a G_UZP1 or G_UZP2 where appropriate. 5# 6# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-lowering -verify-machineinstrs %s -o - | FileCheck %s 7 8... 9--- 10name: uzp1_v4s32 11legalized: true 12tracksRegLiveness: true 13body: | 14 bb.1.entry: 15 liveins: $q0, $q1 16 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 29 30... 31--- 32name: uzp2_v4s32 33legalized: true 34tracksRegLiveness: true 35body: | 36 bb.1.entry: 37 liveins: $q0, $q1 38 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 51 52... 53--- 54name: no_uzp1 55legalized: true 56tracksRegLiveness: true 57body: | 58 bb.1.entry: 59 liveins: $q0, $q1 60 61 ; See isUZPMask: Mask[1] != 2 * i + 0 62 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 75 76... 77--- 78name: no_uzp2 79legalized: true 80tracksRegLiveness: true 81body: | 82 bb.1.entry: 83 liveins: $q0, $q1 84 85 ; See isUZPMask: Mask[1] != 2 * i + 1 86 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 99 100... 101--- 102name: uzp1_undef 103legalized: true 104tracksRegLiveness: true 105body: | 106 bb.1.entry: 107 liveins: $q0, $q1 108 109 ; Make sure that we can still produce a uzp1/uzp2 with undef indices. 110 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 123 124... 125--- 126name: uzp2_undef 127legalized: true 128tracksRegLiveness: true 129body: | 130 bb.1.entry: 131 liveins: $q0, $q1 132 133 ; Make sure that we can still produce a uzp1/uzp2 with undef indices. 134 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 147