llvm-project/llvm/test/CodeGen/AMDGPU/lo16-hi16-physreg-copy.mir

203 lines
4.6 KiB
YAML

# RUN: llc -march=amdgcn -mcpu=gfx900 -start-before postrapseudos -asm-verbose=0 -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
# GCN-LABEL: {{^}}lo_to_lo:
# GCN: v_alignbyte_b32 v1, v0, v1, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
name: lo_to_lo
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_lo16 = COPY $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_hi:
# GCN: v_lshrrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v0, v1, 2
name: lo_to_hi
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_hi16 = COPY killed $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_lo:
# GCN: v_lshlrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v1, v0, 2
name: hi_to_lo
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_lo16 = COPY $vgpr0_hi16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_hi:
# GCN: v_alignbyte_b32 v1, v1, v0, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
name: hi_to_hi
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_hi16 = COPY $vgpr0_hi16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_lo_samereg:
# GCN: s_waitcnt
# GCN-NEXT: s_endpgm
name: lo_to_lo_samereg
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr0_lo16 = COPY $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_hi_samereg:
# GCN: v_pk_add_u16 v0, v0, 0 op_sel_hi:[0,0]
name: lo_to_hi_samereg
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr0_hi16 = COPY $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_lo_samereg:
# GCN: v_pk_add_u16 v0, v0, 0 op_sel:[1,0] op_sel_hi:[1,0]
name: hi_to_lo_samereg
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr0_lo16 = COPY killed $vgpr0_hi16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_hi_samereg:
# GCN: s_waitcnt
# GCN-NEXT: s_endpgm
name: hi_to_hi_samereg
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr0_hi16 = COPY killed $vgpr0_hi16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_lo_def_livein:
# GCN: v_alignbyte_b32 v1, v0, v1, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
name: lo_to_lo_def_livein
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
$vgpr1 = IMPLICIT_DEF
$vgpr1_lo16 = COPY $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_hi_def_livein:
# GCN: v_lshrrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v0, v1, 2
name: lo_to_hi_def_livein
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
$vgpr1 = IMPLICIT_DEF
$vgpr1_hi16 = COPY $vgpr0_lo16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_lo_def_livein:
# GCN: v_lshlrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v1, v0, 2
name: hi_to_lo_def_livein
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
$vgpr1 = IMPLICIT_DEF
$vgpr1_lo16 = COPY killed $vgpr0_hi16
S_ENDPGM 0
...
# GCN-LABEL: {{^}}hi_to_hi_def_livein:
# GCN: v_alignbyte_b32 v1, v1, v0, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
name: hi_to_hi_def_livein
tracksRegLiveness: true
body: |
bb.0:
liveins: $vgpr0
$vgpr1 = IMPLICIT_DEF
$vgpr1_hi16 = COPY $vgpr0_hi16
S_ENDPGM 0
...
# TODO: This can be coalesced into a VGPR_32 copy
# GCN-LABEL: {{^}}lo_to_lo_hi_to_hi:
# GCN: v_alignbyte_b32 v1, v0, v1, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v0, 2
# GCN-NEXT: v_alignbyte_b32 v1, v1, v1, 2
# GCN-NEXT: v_mov_b32_e32 v2, v1
# GCN-NEXT: s_endpgm
name: lo_to_lo_hi_to_hi
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_lo16 = COPY $vgpr0_lo16
$vgpr1_hi16 = COPY $vgpr0_hi16
$vgpr2 = COPY killed $vgpr1
S_ENDPGM 0
...
# GCN-LABEL: {{^}}lo_to_hi_hi_to_lo:
# GCN: v_lshlrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v1, v0, 2
# GCN-NEXT: v_lshrrev_b32_e32 v1, 16, v1
# GCN-NEXT: v_alignbyte_b32 v1, v0, v1, 2
# GCN-NEXT: v_mov_b32_e32 v2, v1
# GCN-NEXT: s_endpgm
name: lo_to_hi_hi_to_lo
tracksRegLiveness: true
body: |
bb.0:
$vgpr0 = IMPLICIT_DEF
$vgpr1_lo16 = COPY $vgpr0_hi16
$vgpr1_hi16 = COPY $vgpr0_lo16
$vgpr2 = COPY killed $vgpr1
S_ENDPGM 0
...
# NB: copy of undef just killed instead of expansion
# GCN-LABEL: {{^}}lo_to_lo_undef:
# GCN: s_waitcnt
# GCN-NEXT: v_mov_b32_e32 v2, v1
# GCN-NEXT: s_endpgm
name: lo_to_lo_undef
tracksRegLiveness: true
body: |
bb.0:
$vgpr1_lo16 = COPY undef $vgpr0_lo16
$vgpr2 = COPY killed $vgpr1
S_ENDPGM 0
...