llvm/llvm/test/CodeGen/AMDGPU/remat-sop.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs --stress-regalloc=2 -start-before=greedy -stop-after=virtregrewriter -o - %s | FileCheck -check-prefix=GCN %s

---
name:            test_remat_s_mov_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mov_b32
    ; GCN: renamable $sgpr0 = S_MOV_B32 1
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_MOV_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_MOV_B32 1
    %1:sreg_32 = S_MOV_B32 2
    %2:sreg_32 = S_MOV_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_no_remat_s_mov_b32_impuse_exec
tracksRegLiveness: true
machineFunctionInfo:
  stackPtrOffsetReg:  $sgpr32
body:             |
  bb.0:
    ; GCN-LABEL: name: test_no_remat_s_mov_b32_impuse_exec
    ; GCN: $exec = IMPLICIT_DEF
    ; GCN-NEXT: renamable $sgpr0 = S_MOV_B32 1, implicit $exec
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr0, %stack.1, implicit $exec, implicit $sgpr32 :: (store (s32) into %stack.1, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 2, implicit $exec
    ; GCN-NEXT: renamable $sgpr0 = S_MOV_B32 3, implicit $exec
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr0, %stack.0, implicit $exec, implicit $sgpr32 :: (store (s32) into %stack.0, addrspace 5)
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.1, implicit $exec, implicit $sgpr32 :: (load (s32) from %stack.1, addrspace 5)
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sgpr32 :: (load (s32) from %stack.0, addrspace 5)
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    $exec = IMPLICIT_DEF
    %0:sreg_32 = S_MOV_B32 1, implicit $exec
    %1:sreg_32 = S_MOV_B32 2, implicit $exec
    %2:sreg_32 = S_MOV_B32 3, implicit $exec
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
# The liverange of %0 covers a point of rematerialization, source value is
# available.
---
name:            test_remat_s_mov_b32_vreg_src_long_lr
tracksRegLiveness: true
machineFunctionInfo:
  stackPtrOffsetReg:  $sgpr32
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mov_b32_vreg_src_long_lr
    ; GCN: renamable $sgpr0 = IMPLICIT_DEF
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = IMPLICIT_DEF
    %1:sreg_32 = S_MOV_B32 %0:sreg_32
    %2:sreg_32 = S_MOV_B32 %0:sreg_32
    %3:sreg_32 = S_MOV_B32 %0:sreg_32
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_NOP 0, implicit %3
    S_NOP 0, implicit %0
    S_ENDPGM 0
...
# The liverange of %0 does not cover a point of rematerialization, source value is
# unavailable and we do not want to artificially extend the liverange.
---
name:            test_no_remat_s_mov_b32_vreg_src_short_lr
tracksRegLiveness: true
machineFunctionInfo:
  stackPtrOffsetReg:  $sgpr32
body:             |
  bb.0:
    ; GCN-LABEL: name: test_no_remat_s_mov_b32_vreg_src_short_lr
    ; GCN: renamable $sgpr0 = IMPLICIT_DEF
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 renamable $sgpr0
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.1, implicit $exec, implicit $sgpr32 :: (store (s32) into %stack.1, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 renamable $sgpr0
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.0, implicit $exec, implicit $sgpr32 :: (store (s32) into %stack.0, addrspace 5)
    ; GCN-NEXT: renamable $sgpr0 = S_MOV_B32 killed renamable $sgpr0
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.1, implicit $exec, implicit $sgpr32 :: (load (s32) from %stack.1, addrspace 5)
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sgpr32 :: (load (s32) from %stack.0, addrspace 5)
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = IMPLICIT_DEF
    %1:sreg_32 = S_MOV_B32 %0:sreg_32
    %2:sreg_32 = S_MOV_B32 %0:sreg_32
    %3:sreg_32 = S_MOV_B32 %0:sreg_32
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_NOP 0, implicit %3
    S_ENDPGM 0
...
---
name:            test_remat_s_mov_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mov_b64
    ; GCN: renamable $sgpr0_sgpr1 = S_MOV_B64 1
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_MOV_B64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr2_sgpr3
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_ENDPGM 0
    %0:sgpr_64 = S_MOV_B64 1
    %1:sgpr_64 = S_MOV_B64 2
    %2:sgpr_64 = S_MOV_B64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_brev_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_brev_b32
    ; GCN: renamable $sgpr0 = S_BREV_B32 1
    ; GCN-NEXT: renamable $sgpr1 = S_BREV_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_BREV_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_BREV_B32 1
    %1:sreg_32 = S_BREV_B32 2
    %2:sreg_32 = S_BREV_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_brev_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_brev_b64
    ; GCN: renamable $sgpr0_sgpr1 = S_BREV_B64 1
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_BREV_B64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr2_sgpr3
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_BREV_B64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_ENDPGM 0
    %0:sgpr_64 = S_BREV_B64 1
    %1:sgpr_64 = S_BREV_B64 2
    %2:sgpr_64 = S_BREV_B64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_ff0_i32_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_ff0_i32_b32
    ; GCN: renamable $sgpr0 = S_FF0_I32_B32 1
    ; GCN-NEXT: renamable $sgpr1 = S_FF0_I32_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FF0_I32_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FF0_I32_B32 1
    %1:sreg_32 = S_FF0_I32_B32 2
    %2:sreg_32 = S_FF0_I32_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_ff1_i32_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_ff1_i32_b32
    ; GCN: renamable $sgpr0 = S_FF1_I32_B32 1
    ; GCN-NEXT: renamable $sgpr1 = S_FF1_I32_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FF1_I32_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FF1_I32_B32 1
    %1:sreg_32 = S_FF1_I32_B32 2
    %2:sreg_32 = S_FF1_I32_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_ff0_i32_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_ff0_i32_b64
    ; GCN: renamable $sgpr0 = S_FF0_I32_B64 1
    ; GCN-NEXT: renamable $sgpr1 = S_FF0_I32_B64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FF0_I32_B64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FF0_I32_B64 1
    %1:sreg_32 = S_FF0_I32_B64 2
    %2:sreg_32 = S_FF0_I32_B64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_ff1_i32_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_ff1_i32_b64
    ; GCN: renamable $sgpr0 = S_FF1_I32_B64 1
    ; GCN-NEXT: renamable $sgpr1 = S_FF1_I32_B64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FF1_I32_B64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FF1_I32_B64 1
    %1:sreg_32 = S_FF1_I32_B64 2
    %2:sreg_32 = S_FF1_I32_B64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_flbit_i32_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_flbit_i32_b32
    ; GCN: renamable $sgpr0 = S_FLBIT_I32_B32 1
    ; GCN-NEXT: renamable $sgpr1 = S_FLBIT_I32_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FLBIT_I32_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FLBIT_I32_B32 1
    %1:sreg_32 = S_FLBIT_I32_B32 2
    %2:sreg_32 = S_FLBIT_I32_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_flbit_i32_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_flbit_i32_b64
    ; GCN: renamable $sgpr0 = S_FLBIT_I32_B64 1
    ; GCN-NEXT: renamable $sgpr1 = S_FLBIT_I32_B64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FLBIT_I32_B64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FLBIT_I32_B64 1
    %1:sreg_32 = S_FLBIT_I32_B64 2
    %2:sreg_32 = S_FLBIT_I32_B64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_flbit_i32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_flbit_i32
    ; GCN: renamable $sgpr0 = S_FLBIT_I32 1
    ; GCN-NEXT: renamable $sgpr1 = S_FLBIT_I32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FLBIT_I32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FLBIT_I32 1
    %1:sreg_32 = S_FLBIT_I32 2
    %2:sreg_32 = S_FLBIT_I32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_flbit_i32_i64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_flbit_i32_i64
    ; GCN: renamable $sgpr0 = S_FLBIT_I32_I64 1
    ; GCN-NEXT: renamable $sgpr1 = S_FLBIT_I32_I64 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_FLBIT_I32_I64 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_FLBIT_I32_I64 1
    %1:sreg_32 = S_FLBIT_I32_I64 2
    %2:sreg_32 = S_FLBIT_I32_I64 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_sext_i32_i8
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_sext_i32_i8
    ; GCN: renamable $sgpr0 = S_SEXT_I32_I8 1
    ; GCN-NEXT: renamable $sgpr1 = S_SEXT_I32_I8 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_SEXT_I32_I8 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_SEXT_I32_I8 1
    %1:sreg_32 = S_SEXT_I32_I8 2
    %2:sreg_32 = S_SEXT_I32_I8 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_sext_i32_i16
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_sext_i32_i16
    ; GCN: renamable $sgpr0 = S_SEXT_I32_I16 1
    ; GCN-NEXT: renamable $sgpr1 = S_SEXT_I32_I16 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_SEXT_I32_I16 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_SEXT_I32_I16 1
    %1:sreg_32 = S_SEXT_I32_I16 2
    %2:sreg_32 = S_SEXT_I32_I16 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_bitreplicate_b64_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_bitreplicate_b64_b32
    ; GCN: renamable $sgpr0_sgpr1 = S_BITREPLICATE_B64_B32 1
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_BITREPLICATE_B64_B32 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr2_sgpr3
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_BITREPLICATE_B64_B32 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_ENDPGM 0
    %0:sgpr_64 = S_BITREPLICATE_B64_B32 1
    %1:sgpr_64 = S_BITREPLICATE_B64_B32 2
    %2:sgpr_64 = S_BITREPLICATE_B64_B32 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_bfm_b32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_bfm_b32
    ; GCN: renamable $sgpr0 = S_BFM_B32 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_BFM_B32 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_BFM_B32 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_BFM_B32 1, 1
    %1:sreg_32 = S_BFM_B32 2, 2
    %2:sreg_32 = S_BFM_B32 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_bfm_b64
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_bfm_b64
    ; GCN: renamable $sgpr0_sgpr1 = S_BFM_B64 1, 1
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_BFM_B64 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr2_sgpr3
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_BFM_B64 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_ENDPGM 0
    %0:sgpr_64 = S_BFM_B64 1, 1
    %1:sgpr_64 = S_BFM_B64 2, 2
    %2:sgpr_64 = S_BFM_B64 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_mul_i32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mul_i32
    ; GCN: renamable $sgpr0 = S_MUL_I32 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_MUL_I32 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_MUL_I32 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_MUL_I32 1, 1
    %1:sreg_32 = S_MUL_I32 2, 2
    %2:sreg_32 = S_MUL_I32 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_mul_hi_i32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mul_hi_i32
    ; GCN: renamable $sgpr0 = S_MUL_HI_I32 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_MUL_HI_I32 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_MUL_HI_I32 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_MUL_HI_I32 1, 1
    %1:sreg_32 = S_MUL_HI_I32 2, 2
    %2:sreg_32 = S_MUL_HI_I32 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_mul_hi_u32
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_mul_hi_u32
    ; GCN: renamable $sgpr0 = S_MUL_HI_U32 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_MUL_HI_U32 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_MUL_HI_U32 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_MUL_HI_U32 1, 1
    %1:sreg_32 = S_MUL_HI_U32 2, 2
    %2:sreg_32 = S_MUL_HI_U32 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_pack_ll_b32_b16
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_pack_ll_b32_b16
    ; GCN: renamable $sgpr0 = S_PACK_LL_B32_B16 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_PACK_LL_B32_B16 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_PACK_LL_B32_B16 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_PACK_LL_B32_B16 1, 1
    %1:sreg_32 = S_PACK_LL_B32_B16 2, 2
    %2:sreg_32 = S_PACK_LL_B32_B16 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_pack_lh_b32_b16
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_pack_lh_b32_b16
    ; GCN: renamable $sgpr0 = S_PACK_LH_B32_B16 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_PACK_LH_B32_B16 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_PACK_LH_B32_B16 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_PACK_LH_B32_B16 1, 1
    %1:sreg_32 = S_PACK_LH_B32_B16 2, 2
    %2:sreg_32 = S_PACK_LH_B32_B16 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...
---
name:            test_remat_s_pack_hh_b32_b16
tracksRegLiveness: true
body:             |
  bb.0:
    ; GCN-LABEL: name: test_remat_s_pack_hh_b32_b16
    ; GCN: renamable $sgpr0 = S_PACK_HH_B32_B16 1, 1
    ; GCN-NEXT: renamable $sgpr1 = S_PACK_HH_B32_B16 2, 2
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr1
    ; GCN-NEXT: renamable $sgpr0 = S_PACK_HH_B32_B16 3, 3
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_32 = S_PACK_HH_B32_B16 1, 1
    %1:sreg_32 = S_PACK_HH_B32_B16 2, 2
    %2:sreg_32 = S_PACK_HH_B32_B16 3, 3
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...

---
name:            test_remat_s_getpc_b64
tracksRegLiveness: true
body:             |
  bb.0:

    ; GCN-LABEL: name: test_remat_s_getpc_b64
    ; GCN: renamable $sgpr0_sgpr1 = S_GETPC_B64_pseudo
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_GETPC_B64_pseudo
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr2_sgpr3
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_GETPC_B64_pseudo
    ; GCN-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1
    ; GCN-NEXT: S_ENDPGM 0
    %0:sgpr_64 = S_GETPC_B64_pseudo
    %1:sgpr_64 = S_GETPC_B64_pseudo
    %2:sgpr_64 = S_GETPC_B64_pseudo
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_NOP 0, implicit %2
    S_ENDPGM 0
...

---
name:            test_remat_s_getpc_b64_2
tracksRegLiveness: true
body:             |
  bb.0:

    ; GCN-LABEL: name: test_remat_s_getpc_b64_2
    ; GCN: renamable $sgpr0_sgpr1 = S_GETPC_B64_pseudo
    ; GCN-NEXT: renamable $sgpr2_sgpr3 = S_GETPC_B64_pseudo
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr0, %stack.3, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.3, addrspace 5)
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.0, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.0, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = COPY renamable $sgpr2
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.1, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.1, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = COPY killed renamable $sgpr3
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr1, %stack.2, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.2, addrspace 5)
    ; GCN-NEXT: renamable $sgpr0_sgpr1 = S_GETPC_B64_pseudo
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr0, %stack.5, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.5, addrspace 5)
    ; GCN-NEXT: renamable $sgpr0 = COPY killed renamable $sgpr1
    ; GCN-NEXT: SI_SPILL_S32_SAVE killed renamable $sgpr0, %stack.4, implicit $exec, implicit $sp_reg :: (store (s32) into %stack.4, addrspace 5)
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.1, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.1, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.3, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.3, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADD_U32 killed renamable $sgpr1, killed renamable $sgpr0, implicit-def $scc
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.0, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.2, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.2, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADDC_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc, implicit $scc
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.3, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.3, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.5, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.5, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADD_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.0, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.4, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.4, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADDC_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc, implicit $scc
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.1, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.1, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.5, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.5, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADD_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc
    ; GCN-NEXT: renamable $sgpr0 = SI_SPILL_S32_RESTORE %stack.2, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.2, addrspace 5)
    ; GCN-NEXT: renamable $sgpr1 = SI_SPILL_S32_RESTORE %stack.4, implicit $exec, implicit $sp_reg :: (load (s32) from %stack.4, addrspace 5)
    ; GCN-NEXT: dead renamable $sgpr0 = S_ADDC_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc, implicit $scc
    ; GCN-NEXT: S_ENDPGM 0
    %0:sreg_64 = S_GETPC_B64_pseudo
    %1:sreg_64 = S_GETPC_B64_pseudo
    %2:sreg_64 = S_GETPC_B64_pseudo
    %4:sreg_32 = COPY %0.sub0:sreg_64
    %5:sreg_32 = COPY %0.sub1:sreg_64
    %6:sreg_32 = COPY %1.sub0:sreg_64
    %7:sreg_32 = COPY %1.sub1:sreg_64
    %8:sreg_32 = COPY %2.sub0:sreg_64
    %9:sreg_32 = COPY %2.sub1:sreg_64
    %10:sreg_32 = S_ADD_U32 %4:sreg_32, %6:sreg_32, implicit-def $scc
    %11:sreg_32 = S_ADDC_U32 %5:sreg_32, %7:sreg_32, implicit-def $scc, implicit $scc
    %12:sreg_32 = S_ADD_U32 %4:sreg_32, %8:sreg_32, implicit-def $scc
    %13:sreg_32 = S_ADDC_U32 %5:sreg_32, %9:sreg_32, implicit-def $scc, implicit $scc
    %14:sreg_32 = S_ADD_U32 %6:sreg_32, %8:sreg_32, implicit-def $scc
    %15:sreg_32 = S_ADDC_U32 %7:sreg_32, %9:sreg_32, implicit-def $scc, implicit $scc
    S_ENDPGM 0
...