1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s 3 4--- 5name: bitreverse_s8 6 7body: | 8 bb.0: 9 liveins: $vgpr0 10 ; CHECK-LABEL: name: bitreverse_s8 11 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 12 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) 13 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]] 14 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24 15 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32) 16 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) 17 ; CHECK: $vgpr0 = COPY [[COPY2]](s32) 18 %0:_(s32) = COPY $vgpr0 19 %1:_(s8) = G_TRUNC %0 20 %2:_(s8) = G_BITREVERSE %1 21 %3:_(s32) = G_ANYEXT %2 22 $vgpr0 = COPY %3 23... 24 25--- 26name: bitreverse_s16 27 28body: | 29 bb.0: 30 liveins: $vgpr0 31 ; CHECK-LABEL: name: bitreverse_s16 32 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 33 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) 34 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]] 35 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 36 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32) 37 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) 38 ; CHECK: $vgpr0 = COPY [[COPY2]](s32) 39 %0:_(s32) = COPY $vgpr0 40 %1:_(s16) = G_TRUNC %0 41 %2:_(s16) = G_BITREVERSE %1 42 %3:_(s32) = G_ANYEXT %2 43 $vgpr0 = COPY %3 44... 45 46--- 47name: bitreverse_s24 48 49body: | 50 bb.0: 51 liveins: $vgpr0 52 ; CHECK-LABEL: name: bitreverse_s24 53 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 54 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) 55 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]] 56 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8 57 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32) 58 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) 59 ; CHECK: $vgpr0 = COPY [[COPY2]](s32) 60 %0:_(s32) = COPY $vgpr0 61 %1:_(s24) = G_TRUNC %0 62 %2:_(s24) = G_BITREVERSE %1 63 %3:_(s32) = G_ANYEXT %2 64 $vgpr0 = COPY %3 65... 66 67--- 68name: bitreverse_s32 69 70body: | 71 bb.0: 72 liveins: $vgpr0 73 ; CHECK-LABEL: name: bitreverse_s32 74 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 75 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]] 76 ; CHECK: $vgpr0 = COPY [[BITREVERSE]](s32) 77 %0:_(s32) = COPY $vgpr0 78 %1:_(s32) = G_BITREVERSE %0 79 $vgpr0 = COPY %1 80... 81 82--- 83name: bitreverse_v2s16 84 85body: | 86 bb.0: 87 liveins: $vgpr0 88 ; CHECK-LABEL: name: bitreverse_v2s16 89 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0 90 ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>) 91 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 92 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32) 93 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32) 94 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY1]] 95 ; CHECK: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32) 96 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) 97 ; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY2]] 98 ; CHECK: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE1]], [[C]](s32) 99 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 100 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR1]](s32) 101 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]] 102 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[LSHR2]](s32) 103 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C1]] 104 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C]](s32) 105 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]] 106 ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32) 107 ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>) 108 %0:_(<2 x s16>) = COPY $vgpr0 109 %1:_(<2 x s16>) = G_BITREVERSE %0 110 $vgpr0 = COPY %1 111... 112 113--- 114name: bitreverse_v2s32 115 116body: | 117 bb.0: 118 liveins: $vgpr0_vgpr1 119 ; CHECK-LABEL: name: bitreverse_v2s32 120 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1 121 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>) 122 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]] 123 ; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]] 124 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[BITREVERSE]](s32), [[BITREVERSE1]](s32) 125 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>) 126 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1 127 %1:_(<2 x s32>) = G_BITREVERSE %0 128 $vgpr0_vgpr1 = COPY %1 129... 130 131--- 132name: bitreverse_s64 133 134body: | 135 bb.0: 136 liveins: $vgpr0_vgpr1 137 ; CHECK-LABEL: name: bitreverse_s64 138 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1 139 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64) 140 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]] 141 ; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]] 142 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE]](s32), [[BITREVERSE1]](s32) 143 ; CHECK: $vgpr0_vgpr1 = COPY [[MV]](s64) 144 %0:_(s64) = COPY $vgpr0_vgpr1 145 %1:_(s64) = G_BITREVERSE %0 146 $vgpr0_vgpr1 = COPY %1 147... 148 149--- 150name: bitreverse_v2s64 151 152body: | 153 bb.0: 154 liveins: $vgpr0_vgpr1_vgpr2_vgpr3 155 ; CHECK-LABEL: name: bitreverse_v2s64 156 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3 157 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>) 158 ; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV]](s64) 159 ; CHECK: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV3]] 160 ; CHECK: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV2]] 161 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE]](s32), [[BITREVERSE1]](s32) 162 ; CHECK: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[UV1]](s64) 163 ; CHECK: [[BITREVERSE2:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV5]] 164 ; CHECK: [[BITREVERSE3:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV4]] 165 ; CHECK: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[BITREVERSE2]](s32), [[BITREVERSE3]](s32) 166 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[MV]](s64), [[MV1]](s64) 167 ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>) 168 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3 169 %1:_(<2 x s64>) = G_BITREVERSE %0 170 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1 171... 172