inst-select-load-atomic-local.mir 11.5 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX6 %s
# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s
# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s

---

name: load_atomic_local_s32_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_s32_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX6: $vgpr0 = COPY [[DS_READ_B32_]]
    ; GFX7-LABEL: name: load_atomic_local_s32_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX7: $vgpr0 = COPY [[DS_READ_B32_]]
    ; GFX9-LABEL: name: load_atomic_local_s32_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[DS_READ_B32_gfx9_:%[0-9]+]]:vgpr_32 = DS_READ_B32_gfx9 [[COPY]], 0, 0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX9: $vgpr0 = COPY [[DS_READ_B32_gfx9_]]
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(s32) = G_LOAD %0 :: (load seq_cst 4, align 4, addrspace 3)
    $vgpr0 = COPY %1

...

---

name: load_atomic_local_v2s16_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_v2s16_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vgpr_32(<2 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX6: $vgpr0 = COPY [[LOAD]](<2 x s16>)
    ; GFX7-LABEL: name: load_atomic_local_v2s16_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vgpr_32(<2 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX7: $vgpr0 = COPY [[LOAD]](<2 x s16>)
    ; GFX9-LABEL: name: load_atomic_local_v2s16_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vgpr_32(<2 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX9: $vgpr0 = COPY [[LOAD]](<2 x s16>)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(<2 x s16>) = G_LOAD %0 :: (load seq_cst 4, align 4, addrspace 3)
    $vgpr0 = COPY %1

...

---

name: load_atomic_local_p3_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_p3_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vgpr_32(p3) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX6: $vgpr0 = COPY [[LOAD]](p3)
    ; GFX7-LABEL: name: load_atomic_local_p3_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vgpr_32(p3) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX7: $vgpr0 = COPY [[LOAD]](p3)
    ; GFX9-LABEL: name: load_atomic_local_p3_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vgpr_32(p3) = G_LOAD [[COPY]](p3) :: (load seq_cst 4, addrspace 3)
    ; GFX9: $vgpr0 = COPY [[LOAD]](p3)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(p3) = G_LOAD %0 :: (load seq_cst 4, align 4, addrspace 3)
    $vgpr0 = COPY %1

...

---

name: load_atomic_local_s64_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_s64_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[DS_READ_B64_:%[0-9]+]]:vreg_64 = DS_READ_B64 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load seq_cst 8, addrspace 3)
    ; GFX6: $vgpr0_vgpr1 = COPY [[DS_READ_B64_]]
    ; GFX7-LABEL: name: load_atomic_local_s64_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[DS_READ_B64_:%[0-9]+]]:vreg_64 = DS_READ_B64 [[COPY]], 0, 0, implicit $m0, implicit $exec :: (load seq_cst 8, addrspace 3)
    ; GFX7: $vgpr0_vgpr1 = COPY [[DS_READ_B64_]]
    ; GFX9-LABEL: name: load_atomic_local_s64_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[DS_READ_B64_gfx9_:%[0-9]+]]:vreg_64 = DS_READ_B64_gfx9 [[COPY]], 0, 0, implicit $exec :: (load seq_cst 8, addrspace 3)
    ; GFX9: $vgpr0_vgpr1 = COPY [[DS_READ_B64_gfx9_]]
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(s64) = G_LOAD %0 :: (load seq_cst 8, align 8, addrspace 3)
    $vgpr0_vgpr1 = COPY %1

...

---

name: load_atomic_local_v2s32_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_v2s32_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vreg_64(<2 x s32>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX6: $vgpr0_vgpr1 = COPY [[LOAD]](<2 x s32>)
    ; GFX7-LABEL: name: load_atomic_local_v2s32_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vreg_64(<2 x s32>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX7: $vgpr0_vgpr1 = COPY [[LOAD]](<2 x s32>)
    ; GFX9-LABEL: name: load_atomic_local_v2s32_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vreg_64(<2 x s32>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX9: $vgpr0_vgpr1 = COPY [[LOAD]](<2 x s32>)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(<2 x s32>) = G_LOAD %0 :: (load seq_cst 8, align 8, addrspace 3)
    $vgpr0_vgpr1 = COPY %1

...

---

name: load_atomic_local_v4s16_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_v4s16_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vreg_64(<4 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX6: $vgpr0_vgpr1 = COPY [[LOAD]](<4 x s16>)
    ; GFX7-LABEL: name: load_atomic_local_v4s16_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vreg_64(<4 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX7: $vgpr0_vgpr1 = COPY [[LOAD]](<4 x s16>)
    ; GFX9-LABEL: name: load_atomic_local_v4s16_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vreg_64(<4 x s16>) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX9: $vgpr0_vgpr1 = COPY [[LOAD]](<4 x s16>)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(<4 x s16>) = G_LOAD %0 :: (load seq_cst 8, align 8, addrspace 3)
    $vgpr0_vgpr1 = COPY %1

...

---

name: load_atomic_local_p1_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_p1_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vreg_64(p1) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX6: $vgpr0_vgpr1 = COPY [[LOAD]](p1)
    ; GFX7-LABEL: name: load_atomic_local_p1_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vreg_64(p1) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX7: $vgpr0_vgpr1 = COPY [[LOAD]](p1)
    ; GFX9-LABEL: name: load_atomic_local_p1_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vreg_64(p1) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX9: $vgpr0_vgpr1 = COPY [[LOAD]](p1)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(p1) = G_LOAD %0 :: (load seq_cst 8, align 8, addrspace 3)
    $vgpr0_vgpr1 = COPY %1

...

---

name: load_atomic_local_p0_seq_cst
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_p0_seq_cst
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[LOAD:%[0-9]+]]:vreg_64(p0) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX6: $vgpr0_vgpr1 = COPY [[LOAD]](p0)
    ; GFX7-LABEL: name: load_atomic_local_p0_seq_cst
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[LOAD:%[0-9]+]]:vreg_64(p0) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX7: $vgpr0_vgpr1 = COPY [[LOAD]](p0)
    ; GFX9-LABEL: name: load_atomic_local_p0_seq_cst
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p3) = COPY $vgpr0
    ; GFX9: [[LOAD:%[0-9]+]]:vreg_64(p0) = G_LOAD [[COPY]](p3) :: (load seq_cst 8, addrspace 3)
    ; GFX9: $vgpr0_vgpr1 = COPY [[LOAD]](p0)
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(p0) = G_LOAD %0 :: (load seq_cst 8, align 8, addrspace 3)
    $vgpr0_vgpr1 = COPY %1

...

---

name: load_atomic_local_s32_seq_cst_gep_65535
legalized:       true
regBankSelected: true
tracksRegLiveness: true

body: |
  bb.0:
    liveins:  $vgpr0

    ; GFX6-LABEL: name: load_atomic_local_s32_seq_cst_gep_65535
    ; GFX6: liveins: $vgpr0
    ; GFX6: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX6: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 65535, implicit $exec
    ; GFX6: %2:vgpr_32, dead %4:sreg_64_xexec = V_ADD_CO_U32_e64 [[COPY]], [[V_MOV_B32_e32_]], 0, implicit $exec
    ; GFX6: $m0 = S_MOV_B32 -1
    ; GFX6: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 %2, 0, 0, implicit $m0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX6: $vgpr0 = COPY [[DS_READ_B32_]]
    ; GFX7-LABEL: name: load_atomic_local_s32_seq_cst_gep_65535
    ; GFX7: liveins: $vgpr0
    ; GFX7: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX7: $m0 = S_MOV_B32 -1
    ; GFX7: [[DS_READ_B32_:%[0-9]+]]:vgpr_32 = DS_READ_B32 [[COPY]], 65535, 0, implicit $m0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX7: $vgpr0 = COPY [[DS_READ_B32_]]
    ; GFX9-LABEL: name: load_atomic_local_s32_seq_cst_gep_65535
    ; GFX9: liveins: $vgpr0
    ; GFX9: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
    ; GFX9: [[DS_READ_B32_gfx9_:%[0-9]+]]:vgpr_32 = DS_READ_B32_gfx9 [[COPY]], 65535, 0, implicit $exec :: (load seq_cst 4, addrspace 3)
    ; GFX9: $vgpr0 = COPY [[DS_READ_B32_gfx9_]]
    %0:vgpr(p3) = COPY $vgpr0
    %1:vgpr(s32) = G_CONSTANT i32 65535
    %2:vgpr(p3) = G_PTR_ADD %0, %1
    %3:vgpr(s32) = G_LOAD %2 :: (load seq_cst 4, align 4, addrspace 3)
    $vgpr0 = COPY %3

...