1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX6 %s 3# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GFX9 %s 4 5--- 6name: narrow_shl_s32_by_2_from_zext_s16 7tracksRegLiveness: true 8body: | 9 bb.0: 10 liveins: $vgpr0 11 12 ; GFX6-LABEL: name: narrow_shl_s32_by_2_from_zext_s16 13 ; GFX6: liveins: $vgpr0 14 ; GFX6: %argument:_(s32) = COPY $vgpr0 15 ; GFX6: %narrow:_(s16) = G_TRUNC %argument(s32) 16 ; GFX6: %masklow14:_(s16) = G_CONSTANT i16 16383 17 ; GFX6: %masked:_(s16) = G_AND %narrow, %masklow14 18 ; GFX6: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2 19 ; GFX6: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16) 20 ; GFX6: %shl:_(s32) = G_ZEXT [[SHL]](s16) 21 ; GFX6: $vgpr0 = COPY %shl(s32) 22 ; GFX9-LABEL: name: narrow_shl_s32_by_2_from_zext_s16 23 ; GFX9: liveins: $vgpr0 24 ; GFX9: %argument:_(s32) = COPY $vgpr0 25 ; GFX9: %narrow:_(s16) = G_TRUNC %argument(s32) 26 ; GFX9: %masklow14:_(s16) = G_CONSTANT i16 16383 27 ; GFX9: %masked:_(s16) = G_AND %narrow, %masklow14 28 ; GFX9: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2 29 ; GFX9: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16) 30 ; GFX9: %shl:_(s32) = G_ZEXT [[SHL]](s16) 31 ; GFX9: $vgpr0 = COPY %shl(s32) 32 %argument:_(s32) = COPY $vgpr0 33 %narrow:_(s16) = G_TRUNC %argument 34 %masklow14:_(s16) = G_CONSTANT i16 16383 35 %masked:_(s16) = G_AND %narrow, %masklow14 36 %extend:_(s32) = G_ZEXT %masked 37 %shiftamt:_(s32) = G_CONSTANT i32 2 38 %shl:_(s32) = G_SHL %extend, %shiftamt 39 $vgpr0 = COPY %shl 40... 41 42--- 43name: narrow_shl_s64_by_2_from_zext_s16 44tracksRegLiveness: true 45body: | 46 bb.0: 47 liveins: $vgpr0 48 49 ; GFX6-LABEL: name: narrow_shl_s64_by_2_from_zext_s16 50 ; GFX6: liveins: $vgpr0 51 ; GFX6: %argument:_(s32) = COPY $vgpr0 52 ; GFX6: %narrow:_(s16) = G_TRUNC %argument(s32) 53 ; GFX6: %masklow14:_(s16) = G_CONSTANT i16 16383 54 ; GFX6: %masked:_(s16) = G_AND %narrow, %masklow14 55 ; GFX6: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2 56 ; GFX6: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16) 57 ; GFX6: %shl:_(s64) = G_ZEXT [[SHL]](s16) 58 ; GFX6: $vgpr0_vgpr1 = COPY %shl(s64) 59 ; GFX9-LABEL: name: narrow_shl_s64_by_2_from_zext_s16 60 ; GFX9: liveins: $vgpr0 61 ; GFX9: %argument:_(s32) = COPY $vgpr0 62 ; GFX9: %narrow:_(s16) = G_TRUNC %argument(s32) 63 ; GFX9: %masklow14:_(s16) = G_CONSTANT i16 16383 64 ; GFX9: %masked:_(s16) = G_AND %narrow, %masklow14 65 ; GFX9: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 2 66 ; GFX9: [[SHL:%[0-9]+]]:_(s16) = G_SHL %masked, [[C]](s16) 67 ; GFX9: %shl:_(s64) = G_ZEXT [[SHL]](s16) 68 ; GFX9: $vgpr0_vgpr1 = COPY %shl(s64) 69 %argument:_(s32) = COPY $vgpr0 70 %narrow:_(s16) = G_TRUNC %argument 71 %masklow14:_(s16) = G_CONSTANT i16 16383 72 %masked:_(s16) = G_AND %narrow, %masklow14 73 %extend:_(s64) = G_ZEXT %masked 74 %shiftamt:_(s32) = G_CONSTANT i32 2 75 %shl:_(s64) = G_SHL %extend, %shiftamt 76 $vgpr0_vgpr1 = COPY %shl 77... 78 79--- 80name: narrow_shl_s16_by_2_from_zext_s8 81tracksRegLiveness: true 82body: | 83 bb.0: 84 liveins: $vgpr0 85 86 ; GFX6-LABEL: name: narrow_shl_s16_by_2_from_zext_s8 87 ; GFX6: liveins: $vgpr0 88 ; GFX6: %argument:_(s32) = COPY $vgpr0 89 ; GFX6: %narrow:_(s8) = G_TRUNC %argument(s32) 90 ; GFX6: %masklow6:_(s8) = G_CONSTANT i8 63 91 ; GFX6: %masked:_(s8) = G_AND %narrow, %masklow6 92 ; GFX6: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 2 93 ; GFX6: [[SHL:%[0-9]+]]:_(s8) = G_SHL %masked, [[C]](s8) 94 ; GFX6: %result:_(s32) = G_ZEXT [[SHL]](s8) 95 ; GFX6: $vgpr0 = COPY %result(s32) 96 ; GFX9-LABEL: name: narrow_shl_s16_by_2_from_zext_s8 97 ; GFX9: liveins: $vgpr0 98 ; GFX9: %argument:_(s32) = COPY $vgpr0 99 ; GFX9: %narrow:_(s8) = G_TRUNC %argument(s32) 100 ; GFX9: %masklow6:_(s8) = G_CONSTANT i8 63 101 ; GFX9: %masked:_(s8) = G_AND %narrow, %masklow6 102 ; GFX9: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 2 103 ; GFX9: [[SHL:%[0-9]+]]:_(s8) = G_SHL %masked, [[C]](s8) 104 ; GFX9: %result:_(s32) = G_ZEXT [[SHL]](s8) 105 ; GFX9: $vgpr0 = COPY %result(s32) 106 %argument:_(s32) = COPY $vgpr0 107 %narrow:_(s8) = G_TRUNC %argument 108 %masklow6:_(s8) = G_CONSTANT i8 63 109 %masked:_(s8) = G_AND %narrow, %masklow6 110 %extend:_(s16) = G_ZEXT %masked 111 %shiftamt:_(s16) = G_CONSTANT i16 2 112 %shl:_(s16) = G_SHL %extend, %shiftamt 113 %result:_(s32) = G_ANYEXT %shl 114 $vgpr0 = COPY %result 115... 116 117--- 118name: narrow_shl_v2s32_by_2_from_zext_v2s16 119tracksRegLiveness: true 120body: | 121 bb.0: 122 liveins: $vgpr0 123 124 ; GFX6-LABEL: name: narrow_shl_v2s32_by_2_from_zext_v2s16 125 ; GFX6: liveins: $vgpr0 126 ; GFX6: %narrow:_(<2 x s16>) = COPY $vgpr0 127 ; GFX6: %masklow14:_(s16) = G_CONSTANT i16 16383 128 ; GFX6: %masklow14vec:_(<2 x s16>) = G_BUILD_VECTOR %masklow14(s16), %masklow14(s16) 129 ; GFX6: %masked:_(<2 x s16>) = G_AND %narrow, %masklow14vec 130 ; GFX6: %extend:_(<2 x s32>) = G_ZEXT %masked(<2 x s16>) 131 ; GFX6: %shiftamt:_(s32) = G_CONSTANT i32 2 132 ; GFX6: %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt(s32), %shiftamt(s32) 133 ; GFX6: %shl:_(<2 x s32>) = G_SHL %extend, %shiftamtvec(<2 x s32>) 134 ; GFX6: $vgpr0_vgpr1 = COPY %shl(<2 x s32>) 135 ; GFX9-LABEL: name: narrow_shl_v2s32_by_2_from_zext_v2s16 136 ; GFX9: liveins: $vgpr0 137 ; GFX9: %narrow:_(<2 x s16>) = COPY $vgpr0 138 ; GFX9: %masklow14:_(s16) = G_CONSTANT i16 16383 139 ; GFX9: %masklow14vec:_(<2 x s16>) = G_BUILD_VECTOR %masklow14(s16), %masklow14(s16) 140 ; GFX9: %masked:_(<2 x s16>) = G_AND %narrow, %masklow14vec 141 ; GFX9: %extend:_(<2 x s32>) = G_ZEXT %masked(<2 x s16>) 142 ; GFX9: %shiftamt:_(s32) = G_CONSTANT i32 2 143 ; GFX9: %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt(s32), %shiftamt(s32) 144 ; GFX9: %shl:_(<2 x s32>) = G_SHL %extend, %shiftamtvec(<2 x s32>) 145 ; GFX9: $vgpr0_vgpr1 = COPY %shl(<2 x s32>) 146 %narrow:_(<2 x s16>) = COPY $vgpr0 147 %masklow14:_(s16) = G_CONSTANT i16 16383 148 %masklow14vec:_(<2 x s16>) = G_BUILD_VECTOR %masklow14, %masklow14 149 %masked:_(<2 x s16>) = G_AND %narrow, %masklow14vec 150 %extend:_(<2 x s32>) = G_ZEXT %masked 151 %shiftamt:_(s32) = G_CONSTANT i32 2 152 %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt, %shiftamt 153 %shl:_(<2 x s32>) = G_SHL %extend, %shiftamtvec 154 $vgpr0_vgpr1 = COPY %shl 155... 156 157--- 158name: narrow_shl_v2s64_by_2_from_anyext_v2s32 159tracksRegLiveness: true 160body: | 161 bb.0: 162 liveins: $vgpr0_vgpr1 163 164 ; GFX6-LABEL: name: narrow_shl_v2s64_by_2_from_anyext_v2s32 165 ; GFX6: liveins: $vgpr0_vgpr1 166 ; GFX6: %narrow:_(<2 x s32>) = COPY $vgpr0_vgpr1 167 ; GFX6: %masklow30:_(s32) = G_CONSTANT i32 1073741823 168 ; GFX6: %masklow30vec:_(<2 x s32>) = G_BUILD_VECTOR %masklow30(s32), %masklow30(s32) 169 ; GFX6: %masked:_(<2 x s32>) = G_AND %narrow, %masklow30vec 170 ; GFX6: %extend:_(<2 x s64>) = G_ANYEXT %masked(<2 x s32>) 171 ; GFX6: %shiftamt:_(s32) = G_CONSTANT i32 2 172 ; GFX6: %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt(s32), %shiftamt(s32) 173 ; GFX6: %shl:_(<2 x s64>) = G_SHL %extend, %shiftamtvec(<2 x s32>) 174 ; GFX6: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %shl(<2 x s64>) 175 ; GFX9-LABEL: name: narrow_shl_v2s64_by_2_from_anyext_v2s32 176 ; GFX9: liveins: $vgpr0_vgpr1 177 ; GFX9: %narrow:_(<2 x s32>) = COPY $vgpr0_vgpr1 178 ; GFX9: %masklow30:_(s32) = G_CONSTANT i32 1073741823 179 ; GFX9: %masklow30vec:_(<2 x s32>) = G_BUILD_VECTOR %masklow30(s32), %masklow30(s32) 180 ; GFX9: %masked:_(<2 x s32>) = G_AND %narrow, %masklow30vec 181 ; GFX9: %extend:_(<2 x s64>) = G_ANYEXT %masked(<2 x s32>) 182 ; GFX9: %shiftamt:_(s32) = G_CONSTANT i32 2 183 ; GFX9: %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt(s32), %shiftamt(s32) 184 ; GFX9: %shl:_(<2 x s64>) = G_SHL %extend, %shiftamtvec(<2 x s32>) 185 ; GFX9: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %shl(<2 x s64>) 186 %narrow:_(<2 x s32>) = COPY $vgpr0_vgpr1 187 %masklow30:_(s32) = G_CONSTANT i32 1073741823 188 %masklow30vec:_(<2 x s32>) = G_BUILD_VECTOR %masklow30, %masklow30 189 %masked:_(<2 x s32>) = G_AND %narrow, %masklow30vec 190 %extend:_(<2 x s64>) = G_ANYEXT %masked 191 %shiftamt:_(s32) = G_CONSTANT i32 2 192 %shiftamtvec:_(<2 x s32>) = G_BUILD_VECTOR %shiftamt, %shiftamt 193 %shl:_(<2 x s64>) = G_SHL %extend, %shiftamtvec 194 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %shl 195... 196