blob: 544aebeaacbfc3778433544b49ae5a64594a31fe [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -global-isel=0 -mtriple=amdgpu12.00-- < %s | FileCheck %s --check-prefixes=GFX12,GFX12-SDAG
; RUN: llc -global-isel=1 -mtriple=amdgpu12.00-- < %s | FileCheck %s --check-prefixes=GFX12,GFX12-GISEL
; A constant VGPR "as memory" (address space 13) pointer formed with inttoptr:
; the dword index (256 >> 2 = 64) is a compile-time constant, so M0 is set from
; that constant and the access is a single M0-relative move.
define i32 @load_i32() {
; GFX12-LABEL: load_i32:
; GFX12: ; %bb.0:
; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-NEXT: s_wait_expcnt 0x0
; GFX12-NEXT: s_wait_samplecnt 0x0
; GFX12-NEXT: s_wait_bvhcnt 0x0
; GFX12-NEXT: s_wait_kmcnt 0x0
; GFX12-NEXT: s_mov_b32 m0, 64
; GFX12-NEXT: v_movrels_b32_e32 v0, v0
; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
; GFX12-NEXT: v_add_nc_u32_e32 v0, 1, v0
; GFX12-NEXT: s_setpc_b64 s[30:31]
%p = inttoptr i32 256 to ptr addrspace(13)
%x = load i32, ptr addrspace(13) %p
%y = add i32 %x, 1
ret i32 %y
}
define void @store_i32(i32 %x) {
; GFX12-LABEL: store_i32:
; GFX12: ; %bb.0:
; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-NEXT: s_wait_expcnt 0x0
; GFX12-NEXT: s_wait_samplecnt 0x0
; GFX12-NEXT: s_wait_bvhcnt 0x0
; GFX12-NEXT: s_wait_kmcnt 0x0
; GFX12-NEXT: v_add_nc_u32_e32 v0, 1, v0
; GFX12-NEXT: s_mov_b32 m0, 64
; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
; GFX12-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-NEXT: s_setpc_b64 s[30:31]
%p = inttoptr i32 256 to ptr addrspace(13)
%y = add i32 %x, 1
store i32 %y, ptr addrspace(13) %p
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; GFX12-GISEL: {{.*}}
; GFX12-SDAG: {{.*}}