legalize-load-constant-32bit.mir 2.88 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=bonaire -O0 -run-pass=legalizer -global-isel-abort=0  %s -o - | FileCheck -check-prefix=CI %s

---
name: test_load_constant32bit_s32_align1
body: |
  bb.0:
    liveins: $vgpr0

    ; CI-LABEL: name: test_load_constant32bit_s32_align1
    ; CI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
    ; CI: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
    ; CI: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
    ; CI: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[MV]](p4) :: (load 1, addrspace 6)
    ; CI: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
    ; CI: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[MV]], [[C1]](s64)
    ; CI: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD]](p4) :: (load 1 + 1, addrspace 6)
    ; CI: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
    ; CI: [[PTR_ADD1:%[0-9]+]]:_(p4) = G_PTR_ADD [[MV]], [[C2]](s64)
    ; CI: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD1]](p4) :: (load 1 + 2, addrspace 6)
    ; CI: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 3
    ; CI: [[PTR_ADD2:%[0-9]+]]:_(p4) = G_PTR_ADD [[MV]], [[C3]](s64)
    ; CI: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[PTR_ADD2]](p4) :: (load 1 + 3, addrspace 6)
    ; CI: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
    ; CI: [[COPY1:%[0-9]+]]:_(s32) = COPY [[LOAD]](s32)
    ; CI: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C4]]
    ; CI: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LOAD1]](s32)
    ; CI: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C4]]
    ; CI: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
    ; CI: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C5]](s32)
    ; CI: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; CI: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LOAD2]](s32)
    ; CI: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C4]]
    ; CI: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CI: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND2]], [[C6]](s32)
    ; CI: [[OR1:%[0-9]+]]:_(s32) = G_OR [[OR]], [[SHL1]]
    ; CI: [[COPY4:%[0-9]+]]:_(s32) = COPY [[LOAD3]](s32)
    ; CI: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C4]]
    ; CI: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CI: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C7]](s32)
    ; CI: [[OR2:%[0-9]+]]:_(s32) = G_OR [[OR1]], [[SHL2]]
    ; CI: $vgpr0 = COPY [[OR2]](s32)
    %0:_(p6) = COPY $vgpr0
    %1:_(s32) = G_LOAD %0 :: (load 4, align 1, addrspace 6)
    $vgpr0 = COPY %1
...

---
name: test_load_constant32bit_s32_align4
body: |
  bb.0:
    liveins: $vgpr0

    ; CI-LABEL: name: test_load_constant32bit_s32_align4
    ; CI: [[COPY:%[0-9]+]]:_(p6) = COPY $vgpr0
    ; CI: [[C:%[0-9]+]]:_(p6) = G_CONSTANT i32 0
    ; CI: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY]](p6), [[C]](p6)
    ; CI: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[MV]](p4) :: (load 4, addrspace 6)
    ; CI: $vgpr0 = COPY [[LOAD]](s32)
    %0:_(p6) = COPY $vgpr0
    %1:_(s32) = G_LOAD %0 :: (load 4, align 4, addrspace 6)
    $vgpr0 = COPY %1
...