blob: a452f351e8b90ee38916c48b2437e40ba9664b57 [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
; RUN: llc -global-isel=0 -mtriple=amdgpu9.42-- < %s | FileCheck %s --check-prefixes=GFX942,GFX942-SDAG
; RUN: llc -global-isel=1 -mtriple=amdgpu9.42-- < %s | FileCheck %s --check-prefixes=GFX942,GFX942-GISEL
; SelectionDAG folds a constant dword offset on the index into the access only
; if the access stays within the addressable VGPRs and the addition cannot
; wrap, which the hardware's does not: the add is nuw, the rest of the index is
; known non-negative, or it is a disjoint or. Anything else, including a
; negative offset, stays in the index. GlobalISel does not fold it yet.
define void @load_plus_3(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_plus_3:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_mov_b32 m0, s0
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v3
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_plus_3:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_plus_3:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v3
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_plus_3:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_plus_3(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_plus_3:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_mov_b32 m0, s0
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v3, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_plus_3:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_plus_3:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v3, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_plus_3:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
; Without nuw, %i may be negative.
define void @load_plus_3_may_wrap(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_plus_3_may_wrap:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, 3
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_plus_3_may_wrap:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_plus_3_may_wrap:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, 3
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_plus_3_may_wrap:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add i32 %i, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_plus_3_may_wrap(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_plus_3_may_wrap:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, 3
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_plus_3_may_wrap:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_plus_3_may_wrap:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, 3
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v0, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_plus_3_may_wrap:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add i32 %i, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
define void @load_plus_3_nonneg_base(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_plus_3_nonneg_base:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_and_b32 m0, s0, 0x3ff
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v3
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_plus_3_nonneg_base:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_plus_3_nonneg_base:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v3
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_plus_3_nonneg_base:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%b = and i32 %i, 1023
%j = add i32 %b, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_plus_3_nonneg_base(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_plus_3_nonneg_base:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_and_b32 m0, s0, 0x3ff
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v3, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_plus_3_nonneg_base:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_plus_3_nonneg_base:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v3, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_plus_3_nonneg_base:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_and_b32 s0, s0, 0x3ff
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 12
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%b = and i32 %i, 1023
%j = add i32 %b, 3
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
define void @load_or_disjoint_plus_1(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_or_disjoint_plus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_lshl_b32 m0, s0, 1
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v1
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_or_disjoint_plus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 3
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_or_disjoint_plus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_lshl_b32 s0, s0, 1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v1
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_or_disjoint_plus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl_b32 s0, s0, 3
; GFX942-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%b = shl i32 %i, 1
%j = or disjoint i32 %b, 1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_or_disjoint_plus_1(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_or_disjoint_plus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_lshl_b32 m0, s0, 1
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v1, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_or_disjoint_plus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 3
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_or_disjoint_plus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_lshl_b32 s0, s0, 1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v1, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_or_disjoint_plus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl_b32 s0, s0, 3
; GFX942-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%b = shl i32 %i, 1
%j = or disjoint i32 %b, 1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
; An or that is not disjoint is not an add, so it does not fold.
define void @load_or_not_disjoint_plus_1(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_or_not_disjoint_plus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_or_b32 m0, s0, 1
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_or_not_disjoint_plus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 2
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_or_not_disjoint_plus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_or_b32 s0, s0, 1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_or_not_disjoint_plus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = or i32 %i, 1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_or_not_disjoint_plus_1(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_or_not_disjoint_plus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_or_b32 m0, s0, 1
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_or_not_disjoint_plus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl_b32 s0, s0, 2
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_or_not_disjoint_plus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_or_b32 s0, s0, 1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v0, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_or_not_disjoint_plus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_or_b32 s0, s0, 4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = or i32 %i, 1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
define void @load_minus_1(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_minus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, -1
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_minus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, -4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_minus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, -1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_minus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, -4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add i32 %i, -1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load i32, ptr addrspace(13) %p, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_minus_1(i32 inreg %i, i32 %v) {
; GFX12-SDAG-LABEL: store_minus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, -1
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_minus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, -4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_minus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, -1
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v0, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_minus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, -4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add i32 %i, -1
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store i32 %v, ptr addrspace(13) %p, align 4
ret void
}
define void @load_gep_minus_1(ptr addrspace(1) %out, ptr addrspace(13) inreg %p) {
; GFX12-SDAG-LABEL: load_gep_minus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, -4
; GFX12-SDAG-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-SDAG-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-SDAG-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_gep_minus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_add_co_u32 s0, s0, -4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: global_store_b32 v[0:1], v2, off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_gep_minus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, -4
; GFX942-SDAG-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dword v[0:1], v2, off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_gep_minus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_add_u32 s0, s0, -4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dword v[0:1], v2, off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%q = getelementptr i32, ptr addrspace(13) %p, i32 -1
%v = load i32, ptr addrspace(13) %q, align 4
store i32 %v, ptr addrspace(1) %out, align 4
ret void
}
define void @store_gep_minus_1(ptr addrspace(13) inreg %p, i32 %v) {
; GFX12-SDAG-LABEL: store_gep_minus_1:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 s0, s0, -4
; GFX12-SDAG-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-SDAG-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_gep_minus_1:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_add_co_u32 s0, s0, -4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_gep_minus_1:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_add_i32 s0, s0, -4
; GFX942-SDAG-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v0, v0
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_gep_minus_1:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_add_u32 s0, s0, -4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%q = getelementptr i32, ptr addrspace(13) %p, i32 -1
store i32 %v, ptr addrspace(13) %q, align 4
ret void
}
; v252..v255 is the last four-dword access inside the first 256 VGPRs.
define void @load_v4i32_plus_252(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_v4i32_plus_252:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_mov_b32 m0, s0
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v252
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v3, v253
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v4, v254
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v5, v255
; GFX12-SDAG-NEXT: global_store_b128 v[0:1], v[2:5], off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_v4i32_plus_252:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f0
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v3, v1
; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v4, v2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v5, v3
; GFX12-GISEL-NEXT: global_store_b128 v[0:1], v[2:5], off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_v4i32_plus_252:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v252
; GFX942-SDAG-NEXT: v_mov_b32_e32 v3, v253
; GFX942-SDAG-NEXT: v_mov_b32_e32 v4, v254
; GFX942-SDAG-NEXT: v_mov_b32_e32 v5, v255
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dwordx4 v[0:1], v[2:5], off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_v4i32_plus_252:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f0
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: v_mov_b32_e32 v3, v1
; GFX942-GISEL-NEXT: v_mov_b32_e32 v4, v2
; GFX942-GISEL-NEXT: v_mov_b32_e32 v5, v3
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dwordx4 v[0:1], v[2:5], off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 252
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load <4 x i32>, ptr addrspace(13) %p, align 4
store <4 x i32> %v, ptr addrspace(1) %out, align 16
ret void
}
define void @store_v4i32_plus_252(i32 inreg %i, <4 x i32> %v) {
; GFX12-SDAG-LABEL: store_v4i32_plus_252:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_mov_b32 m0, s0
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v252, v0
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v253, v1
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v254, v2
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v255, v3
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_v4i32_plus_252:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f0
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v1, v1
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v2, v2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v3, v3
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_v4i32_plus_252:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v252, v0
; GFX942-SDAG-NEXT: v_mov_b32_e32 v253, v1
; GFX942-SDAG-NEXT: v_mov_b32_e32 v254, v2
; GFX942-SDAG-NEXT: v_mov_b32_e32 v255, v3
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_v4i32_plus_252:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f0
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: v_mov_b32_e32 v1, v1
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v2
; GFX942-GISEL-NEXT: v_mov_b32_e32 v3, v3
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 252
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store <4 x i32> %v, ptr addrspace(13) %p, align 4
ret void
}
define void @load_v4i32_plus_253(ptr addrspace(1) %out, i32 inreg %i) {
; GFX12-SDAG-LABEL: load_v4i32_plus_253:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, 0xfd
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v3, v1
; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v4, v2
; GFX12-SDAG-NEXT: v_movrels_b32_e32 v5, v3
; GFX12-SDAG-NEXT: global_store_b128 v[0:1], v[2:5], off
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: load_v4i32_plus_253:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v2, v0
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v3, v1
; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v4, v2
; GFX12-GISEL-NEXT: v_movrels_b32_e32 v5, v3
; GFX12-GISEL-NEXT: global_store_b128 v[0:1], v[2:5], off
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: load_v4i32_plus_253:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_addk_i32 s0, 0xfd
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v0
; GFX942-SDAG-NEXT: v_mov_b32_e32 v3, v1
; GFX942-SDAG-NEXT: v_mov_b32_e32 v4, v2
; GFX942-SDAG-NEXT: v_mov_b32_e32 v5, v3
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: global_store_dwordx4 v[0:1], v[2:5], off
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0)
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: load_v4i32_plus_253:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(SRC0)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v0
; GFX942-GISEL-NEXT: v_mov_b32_e32 v3, v1
; GFX942-GISEL-NEXT: v_mov_b32_e32 v4, v2
; GFX942-GISEL-NEXT: v_mov_b32_e32 v5, v3
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: global_store_dwordx4 v[0:1], v[2:5], off
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0)
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 253
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
%v = load <4 x i32>, ptr addrspace(13) %p, align 4
store <4 x i32> %v, ptr addrspace(1) %out, align 16
ret void
}
define void @store_v4i32_plus_253(i32 inreg %i, <4 x i32> %v) {
; GFX12-SDAG-LABEL: store_v4i32_plus_253:
; GFX12-SDAG: ; %bb.0:
; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
; GFX12-SDAG-NEXT: s_add_co_i32 m0, s0, 0xfd
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v1, v1
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v2, v2
; GFX12-SDAG-NEXT: v_movreld_b32_e32 v3, v3
; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX12-GISEL-LABEL: store_v4i32_plus_253:
; GFX12-GISEL: ; %bb.0:
; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
; GFX12-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f4
; GFX12-GISEL-NEXT: s_wait_alu depctr_sa_sdst(0)
; GFX12-GISEL-NEXT: s_lshr_b32 m0, s0, 2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v0, v0
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v1, v1
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v2, v2
; GFX12-GISEL-NEXT: v_movreld_b32_e32 v3, v3
; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-SDAG-LABEL: store_v4i32_plus_253:
; GFX942-SDAG: ; %bb.0:
; GFX942-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-SDAG-NEXT: s_addk_i32 s0, 0xfd
; GFX942-SDAG-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-SDAG-NEXT: v_mov_b32_e32 v0, v0
; GFX942-SDAG-NEXT: v_mov_b32_e32 v1, v1
; GFX942-SDAG-NEXT: v_mov_b32_e32 v2, v2
; GFX942-SDAG-NEXT: v_mov_b32_e32 v3, v3
; GFX942-SDAG-NEXT: s_set_gpr_idx_off
; GFX942-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX942-GISEL-LABEL: store_v4i32_plus_253:
; GFX942-GISEL: ; %bb.0:
; GFX942-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX942-GISEL-NEXT: s_lshl2_add_u32 s0, s0, 0x3f4
; GFX942-GISEL-NEXT: s_lshr_b32 s0, s0, 2
; GFX942-GISEL-NEXT: s_set_gpr_idx_on s0, gpr_idx(DST)
; GFX942-GISEL-NEXT: v_mov_b32_e32 v0, v0
; GFX942-GISEL-NEXT: v_mov_b32_e32 v1, v1
; GFX942-GISEL-NEXT: v_mov_b32_e32 v2, v2
; GFX942-GISEL-NEXT: v_mov_b32_e32 v3, v3
; GFX942-GISEL-NEXT: s_set_gpr_idx_off
; GFX942-GISEL-NEXT: s_setpc_b64 s[30:31]
%j = add nuw i32 %i, 253
%s = shl nuw i32 %j, 2
%p = inttoptr i32 %s to ptr addrspace(13)
store <4 x i32> %v, ptr addrspace(13) %p, align 4
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; GFX12: {{.*}}
; GFX942: {{.*}}