inst-select-lshr.s16.mir 14.8 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py

# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -global-isel-abort=2 -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX8 %s
# RUN: FileCheck -check-prefixes=ERR-GFX8,ERR %s < %t

# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -global-isel-abort=2 -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX9 %s
# RUN: FileCheck -check-prefixes=ERR-GFX910,ERR %s < %t

# RUN: llc -march=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -global-isel-abort=2 -disable-gisel-legality-check -pass-remarks-missed='gisel*' -verify-machineinstrs %s -o - 2>%t | FileCheck -check-prefix=GFX10 %s
# RUN: FileCheck -check-prefixes=ERR-GFX910,ERR %s < %t

# ERR-NOT: remark
# ERR: remark: <unknown>:0:0: cannot select: %4:sgpr(s16) = G_LSHR %2:sgpr, %3:sgpr(s16) (in function: lshr_s16_s16_ss)
# ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_LSHR %2:vgpr, %1:vgpr(s32) (in function: lshr_s16_s32_vv)
# ERR-NEXT: remark: <unknown>:0:0: cannot select: %5:vgpr(s64) = G_ZEXT %4:vgpr(s16) (in function: lshr_s16_vv_zext_to_s64)
# ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:sgpr(s16) = G_LSHR %2:sgpr, %1:sgpr(s32) (in function: lshr_s16_s32_ss)
# ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_LSHR %2:sgpr, %1:vgpr(s32) (in function: lshr_s16_s32_sv)
# ERR-NEXT: remark: <unknown>:0:0: cannot select: %3:vgpr(s16) = G_LSHR %2:vgpr, %1:sgpr(s32) (in function: lshr_s16_s32_vs)
# ERR-NOT: remark

---
name: lshr_s16_s16_ss
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $sgpr1

    ; GFX8-LABEL: name: lshr_s16_s16_ss
    ; GFX8: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX8: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX8: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX9-LABEL: name: lshr_s16_s16_ss
    ; GFX9: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX9: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX9: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX10-LABEL: name: lshr_s16_s16_ss
    ; GFX10: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX10: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX10: S_ENDPGM 0, implicit [[LSHR]](s16)
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s32) = COPY $sgpr1
    %2:sgpr(s16) = G_TRUNC %0
    %3:sgpr(s16) = G_TRUNC %1
    %4:sgpr(s16) = G_LSHR %2, %3
    S_ENDPGM 0, implicit %4
...

---
name: lshr_s16_s16_vs
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $vgpr0
    ; GFX8-LABEL: name: lshr_s16_s16_vs
    ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX8: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX8: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX9-LABEL: name: lshr_s16_s16_vs
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX9: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX9: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX10-LABEL: name: lshr_s16_s16_vs
    ; GFX10: $vcc_hi = IMPLICIT_DEF
    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX10: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX10: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    %0:vgpr(s32) = COPY $vgpr0
    %1:sgpr(s32) = COPY $sgpr0
    %2:vgpr(s16) = G_TRUNC %0
    %3:sgpr(s16) = G_TRUNC %1
    %4:vgpr(s16) = G_LSHR %2, %3
    S_ENDPGM 0, implicit %4
...

---
name: lshr_s16_s32_vv
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; GFX8-LABEL: name: lshr_s16_s32_vv
    ; GFX8: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX8: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX8: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX9-LABEL: name: lshr_s16_s32_vv
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX9: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX9: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX10-LABEL: name: lshr_s16_s32_vv
    ; GFX10: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX10: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX10: S_ENDPGM 0, implicit [[LSHR]](s16)
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s32) = COPY $vgpr1
    %2:vgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_LSHR %2, %1
    S_ENDPGM 0, implicit %3
...

---
name: lshr_s16_s16_vv
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; GFX8-LABEL: name: lshr_s16_s16_vv
    ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX8: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX8: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX9-LABEL: name: lshr_s16_s16_vv
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX9: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX9: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX10-LABEL: name: lshr_s16_s16_vv
    ; GFX10: $vcc_hi = IMPLICIT_DEF
    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX10: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX10: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s32) = COPY $vgpr1
    %2:vgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_TRUNC %1
    %4:vgpr(s16) = G_LSHR %2, %3
    S_ENDPGM 0, implicit %4
...

---
name: lshr_s16_s16_vv_zext_to_s32
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; GFX8-LABEL: name: lshr_s16_s16_vv_zext_to_s32
    ; GFX8: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX8: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX8: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX9-LABEL: name: lshr_s16_s16_vv_zext_to_s32
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX9: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX9: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX10-LABEL: name: lshr_s16_s16_vv_zext_to_s32
    ; GFX10: $vcc_hi = IMPLICIT_DEF
    ; GFX10: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
    ; GFX10: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX10: [[V_BFE_U32_:%[0-9]+]]:vgpr_32 = V_BFE_U32 [[V_LSHRREV_B16_e64_]], 0, 16, implicit $exec
    ; GFX10: S_ENDPGM 0, implicit [[V_BFE_U32_]]
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s32) = COPY $vgpr1
    %2:vgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_TRUNC %1
    %4:vgpr(s16) = G_LSHR %2, %3
    %5:vgpr(s32) = G_ZEXT %4
    S_ENDPGM 0, implicit %5
...

---
name: lshr_s16_vv_zext_to_s64
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; GFX8-LABEL: name: lshr_s16_vv_zext_to_s64
    ; GFX8: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX8: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX8: [[ZEXT:%[0-9]+]]:vgpr(s64) = G_ZEXT [[LSHR]](s16)
    ; GFX8: S_ENDPGM 0, implicit [[ZEXT]](s64)
    ; GFX9-LABEL: name: lshr_s16_vv_zext_to_s64
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX9: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX9: [[ZEXT:%[0-9]+]]:vgpr(s64) = G_ZEXT [[LSHR]](s16)
    ; GFX9: S_ENDPGM 0, implicit [[ZEXT]](s64)
    ; GFX10-LABEL: name: lshr_s16_vv_zext_to_s64
    ; GFX10: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
    ; GFX10: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
    ; GFX10: [[ZEXT:%[0-9]+]]:vgpr(s64) = G_ZEXT [[LSHR]](s16)
    ; GFX10: S_ENDPGM 0, implicit [[ZEXT]](s64)
    %0:vgpr(s32) = COPY $vgpr0
    %1:vgpr(s32) = COPY $vgpr1
    %2:vgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_TRUNC %1
    %4:vgpr(s16) = G_LSHR %2, %3
    %5:vgpr(s64) = G_ZEXT %4
    S_ENDPGM 0, implicit %5
...

---
name: lshr_s16_s32_ss
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $sgpr1

    ; GFX8-LABEL: name: lshr_s16_s32_ss
    ; GFX8: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX8: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX8: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX9-LABEL: name: lshr_s16_s32_ss
    ; GFX9: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX9: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX9: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX10-LABEL: name: lshr_s16_s32_ss
    ; GFX10: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
    ; GFX10: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:sgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX10: S_ENDPGM 0, implicit [[LSHR]](s16)
    %0:sgpr(s32) = COPY $sgpr0
    %1:sgpr(s32) = COPY $sgpr1
    %2:sgpr(s16) = G_TRUNC %0
    %3:sgpr(s16) = G_LSHR %2, %1
    S_ENDPGM 0, implicit %3
...

---
name: lshr_s16_s32_sv
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $vgpr0
    ; GFX8-LABEL: name: lshr_s16_s32_sv
    ; GFX8: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX8: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX8: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX9-LABEL: name: lshr_s16_s32_sv
    ; GFX9: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX9: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX9: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX10-LABEL: name: lshr_s16_s32_sv
    ; GFX10: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX10: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX10: S_ENDPGM 0, implicit [[LSHR]](s16)
    %0:sgpr(s32) = COPY $sgpr0
    %1:vgpr(s32) = COPY $vgpr0
    %2:sgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_LSHR %2, %1
    S_ENDPGM 0, implicit %3
...

---
name: lshr_s16_s16_sv
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $vgpr0
    ; GFX8-LABEL: name: lshr_s16_s16_sv
    ; GFX8: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX8: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX8: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX9-LABEL: name: lshr_s16_s16_sv
    ; GFX9: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX9: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    ; GFX10-LABEL: name: lshr_s16_s16_sv
    ; GFX10: $vcc_hi = IMPLICIT_DEF
    ; GFX10: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX10: [[V_LSHRREV_B16_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B16_e64 [[COPY1]], [[COPY]], implicit $exec
    ; GFX10: S_ENDPGM 0, implicit [[V_LSHRREV_B16_e64_]]
    %0:sgpr(s32) = COPY $sgpr0
    %1:vgpr(s32) = COPY $vgpr0
    %2:sgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_TRUNC %1
    %4:vgpr(s16) = G_LSHR %2, %3
    S_ENDPGM 0, implicit %4
...

---
name: lshr_s16_s32_vs
legalized: true
regBankSelected: true

body: |
  bb.0:
    liveins: $sgpr0, $vgpr0
    ; GFX8-LABEL: name: lshr_s16_s32_vs
    ; GFX8: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX8: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX8: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX8: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX8: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX9-LABEL: name: lshr_s16_s32_vs
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX9: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX9: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX9: S_ENDPGM 0, implicit [[LSHR]](s16)
    ; GFX10-LABEL: name: lshr_s16_s32_vs
    ; GFX10: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
    ; GFX10: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
    ; GFX10: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
    ; GFX10: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY1]](s32)
    ; GFX10: S_ENDPGM 0, implicit [[LSHR]](s16)
    %0:vgpr(s32) = COPY $vgpr0
    %1:sgpr(s32) = COPY $sgpr0
    %2:vgpr(s16) = G_TRUNC %0
    %3:vgpr(s16) = G_LSHR %2, %1
    S_ENDPGM 0, implicit %3
...