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: cttz_zero_undef_s32_s32 6 7body: | 8 bb.0: 9 liveins: $vgpr0 10 ; CHECK-LABEL: name: cttz_zero_undef_s32_s32 11 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 12 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s32) 13 ; CHECK: $vgpr0 = COPY [[CTTZ_ZERO_UNDEF]](s32) 14 %0:_(s32) = COPY $vgpr0 15 %1:_(s32) = G_CTTZ_ZERO_UNDEF %0 16 $vgpr0 = COPY %1 17... 18 19--- 20name: cttz_zero_undef_s32_s64 21 22body: | 23 bb.0: 24 liveins: $vgpr0_vgpr1 25 ; CHECK-LABEL: name: cttz_zero_undef_s32_s64 26 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1 27 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64) 28 ; CHECK: $vgpr0 = COPY [[CTTZ_ZERO_UNDEF]](s32) 29 %0:_(s64) = COPY $vgpr0_vgpr1 30 %1:_(s32) = G_CTTZ_ZERO_UNDEF %0 31 $vgpr0 = COPY %1 32... 33 34--- 35name: cttz_zero_undef_s64_s64 36 37body: | 38 bb.0: 39 liveins: $vgpr0_vgpr1 40 ; CHECK-LABEL: name: cttz_zero_undef_s64_s64 41 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1 42 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64) 43 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ_ZERO_UNDEF]](s32) 44 ; CHECK: $vgpr0_vgpr1 = COPY [[ZEXT]](s64) 45 %0:_(s64) = COPY $vgpr0_vgpr1 46 %1:_(s64) = G_CTTZ_ZERO_UNDEF %0 47 $vgpr0_vgpr1 = COPY %1 48... 49 50--- 51name: cttz_zero_undef_s16_s32 52 53body: | 54 bb.0: 55 liveins: $vgpr0 56 ; CHECK-LABEL: name: cttz_zero_undef_s16_s32 57 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 58 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s32) 59 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 60 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32) 61 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] 62 ; CHECK: $vgpr0 = COPY [[AND]](s32) 63 %0:_(s32) = COPY $vgpr0 64 %1:_(s16) = G_CTTZ_ZERO_UNDEF %0 65 %2:_(s32) = G_ZEXT %1 66 $vgpr0 = COPY %2 67... 68 69--- 70name: cttz_zero_undef_s16_s16 71 72body: | 73 bb.0: 74 liveins: $vgpr0 75 ; CHECK-LABEL: name: cttz_zero_undef_s16_s16 76 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 77 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 78 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) 79 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] 80 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32) 81 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32) 82 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) 83 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]] 84 ; CHECK: $vgpr0 = COPY [[AND1]](s32) 85 %0:_(s32) = COPY $vgpr0 86 %1:_(s16) = G_TRUNC %0 87 %2:_(s16) = G_CTTZ_ZERO_UNDEF %1 88 %3:_(s32) = G_ZEXT %2 89 $vgpr0 = COPY %3 90... 91 92--- 93name: cttz_zero_undef_v2s32_v2s32 94 95body: | 96 bb.0: 97 liveins: $vgpr0_vgpr1 98 ; CHECK-LABEL: name: cttz_zero_undef_v2s32_v2s32 99 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1 100 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>) 101 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s32) 102 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s32) 103 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ_ZERO_UNDEF]](s32), [[CTTZ_ZERO_UNDEF1]](s32) 104 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>) 105 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1 106 %1:_(<2 x s32>) = G_CTTZ_ZERO_UNDEF %0 107 $vgpr0_vgpr1 = COPY %1 108... 109 110--- 111name: cttz_zero_undef_v2s32_v2s64 112 113body: | 114 bb.0: 115 liveins: $vgpr0_vgpr1_vgpr2_vgpr3 116 ; CHECK-LABEL: name: cttz_zero_undef_v2s32_v2s64 117 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3 118 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>) 119 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s64) 120 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s64) 121 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ_ZERO_UNDEF]](s32), [[CTTZ_ZERO_UNDEF1]](s32) 122 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>) 123 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3 124 %1:_(<2 x s32>) = G_CTTZ_ZERO_UNDEF %0 125 $vgpr0_vgpr1 = COPY %1 126... 127 128--- 129name: cttz_zero_undef_v2s16_v2s16 130 131body: | 132 bb.0: 133 liveins: $vgpr0 134 ; CHECK-LABEL: name: cttz_zero_undef_v2s16_v2s16 135 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0 136 ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>) 137 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 138 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32) 139 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 140 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32) 141 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]] 142 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32) 143 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32) 144 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32) 145 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]] 146 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND1]](s32) 147 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF1]](s32) 148 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) 149 ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C1]] 150 ; CHECK: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32) 151 ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C1]] 152 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C]](s32) 153 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL]] 154 ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32) 155 ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>) 156 %0:_(<2 x s16>) = COPY $vgpr0 157 %1:_(<2 x s16>) = G_CTTZ_ZERO_UNDEF %0 158 $vgpr0 = COPY %1 159... 160 161--- 162name: cttz_zero_undef_s7_s7 163 164body: | 165 bb.0: 166 liveins: $vgpr0 167 168 ; CHECK-LABEL: name: cttz_zero_undef_s7_s7 169 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 170 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 171 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) 172 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] 173 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32) 174 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32) 175 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) 176 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]] 177 ; CHECK: $vgpr0 = COPY [[AND1]](s32) 178 %0:_(s32) = COPY $vgpr0 179 %1:_(s7) = G_TRUNC %0 180 %2:_(s7) = G_CTTZ_ZERO_UNDEF %1 181 %3:_(s32) = G_ZEXT %2 182 $vgpr0 = COPY %3 183... 184 185--- 186name: cttz_zero_undef_s33_s33 187 188body: | 189 bb.0: 190 liveins: $vgpr0_vgpr1 191 192 ; CHECK-LABEL: name: cttz_zero_undef_s33_s33 193 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1 194 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591 195 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64) 196 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]] 197 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s64) 198 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ_ZERO_UNDEF]](s32) 199 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295 200 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[ZEXT]](s64) 201 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[C1]](s64) 202 ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[COPY3]] 203 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[AND1]](s64) 204 ; CHECK: $vgpr0_vgpr1 = COPY [[COPY4]](s64) 205 %0:_(s64) = COPY $vgpr0_vgpr1 206 %1:_(s33) = G_TRUNC %0 207 %2:_(s33) = G_CTTZ_ZERO_UNDEF %1 208 %3:_(s64) = G_ANYEXT %2 209 $vgpr0_vgpr1 = COPY %3 210... 211