From f7cfa3a7ab947c64dfe0e2864dcb6e8c4bf1486e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 7 Jun 2023 18:12:55 -0400 Subject: [PATCH] AMDGPU: Merge dag and gisel tests for non-entry LDS handling --- .../AMDGPU/GlobalISel/lds-global-non-entry-func.ll | 55 ---------- .../CodeGen/AMDGPU/lds-global-non-entry-func.ll | 116 +++++++++++++++------ 2 files changed, 82 insertions(+), 89 deletions(-) delete mode 100644 llvm/test/CodeGen/AMDGPU/GlobalISel/lds-global-non-entry-func.ll diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/lds-global-non-entry-func.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/lds-global-non-entry-func.ll deleted file mode 100644 index ea0376a..0000000 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/lds-global-non-entry-func.ll +++ /dev/null @@ -1,55 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -amdgpu-enable-lower-module-lds=false -o - %s 2> %t | FileCheck --check-prefix=GFX8 %s -; RUN: FileCheck -check-prefix=ERR %s < %t - -; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-enable-lower-module-lds=false -o - %s 2> %t | FileCheck --check-prefix=GFX9 %s -; RUN: FileCheck -check-prefix=ERR %s < %t - -@lds = internal addrspace(3) global float undef, align 4 - -; ERR: warning: :0:0: in function func_use_lds_global void (): local memory global used by non-kernel function -define void @func_use_lds_global() { -; GFX8-LABEL: func_use_lds_global: -; GFX8: ; %bb.0: -; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT: v_mov_b32_e32 v0, 0 -; GFX8-NEXT: s_mov_b32 m0, -1 -; GFX8-NEXT: s_mov_b64 s[0:1], s[6:7] -; GFX8-NEXT: s_trap 2 -; GFX8-NEXT: ds_write_b32 v0, v0 -; GFX8-NEXT: s_waitcnt lgkmcnt(0) -; GFX8-NEXT: s_setpc_b64 s[30:31] -; -; GFX9-LABEL: func_use_lds_global: -; GFX9: ; %bb.0: -; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: v_mov_b32_e32 v0, 0 -; GFX9-NEXT: s_trap 2 -; GFX9-NEXT: ds_write_b32 v0, v0 -; GFX9-NEXT: s_waitcnt lgkmcnt(0) -; GFX9-NEXT: s_setpc_b64 s[30:31] - store float 0.0, ptr addrspace(3) @lds, align 4 - ret void -} - -; ERR: warning: :0:0: in function func_use_lds_global_constexpr_cast void (): local memory global used by non-kernel function -define void @func_use_lds_global_constexpr_cast() { -; GFX8-LABEL: func_use_lds_global_constexpr_cast: -; GFX8: ; %bb.0: -; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT: s_mov_b64 s[0:1], s[6:7] -; GFX8-NEXT: s_trap 2 -; GFX8-NEXT: flat_store_dword v[0:1], v0 -; GFX8-NEXT: s_waitcnt vmcnt(0) -; GFX8-NEXT: s_setpc_b64 s[30:31] -; -; GFX9-LABEL: func_use_lds_global_constexpr_cast: -; GFX9: ; %bb.0: -; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: s_trap 2 -; GFX9-NEXT: global_store_dword v[0:1], v0, off -; GFX9-NEXT: s_waitcnt vmcnt(0) -; GFX9-NEXT: s_setpc_b64 s[30:31] - store i32 ptrtoint (ptr addrspace(3) @lds to i32), ptr addrspace(1) undef, align 4 - ret void -} diff --git a/llvm/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll b/llvm/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll index 2e3aefa..d7f82ce 100644 --- a/llvm/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll +++ b/llvm/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll @@ -1,51 +1,99 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX8 %s +; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX8,GFX8-SDAG %s ; RUN: FileCheck -check-prefix=ERR %s < %t -; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX9 %s +; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX8,GFX8-GISEL %s ; RUN: FileCheck -check-prefix=ERR %s < %t -@lds = internal addrspace(3) global float undef, align 4 +; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX9,GFX9-SDAG %s +; RUN: FileCheck -check-prefix=ERR %s < %t + +; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - -amdgpu-enable-lower-module-lds=false %s 2> %t | FileCheck -check-prefixes=GFX9,GFX9-GISEL %s +; RUN: FileCheck -check-prefix=ERR %s < %t + +@lds = internal addrspace(3) global float poison, align 4 + +; FIXME: The DAG should probably move the trap before the access. ; ERR: warning: :0:0: in function func_use_lds_global void (): local memory global used by non-kernel function define void @func_use_lds_global() { -; GFX8-LABEL: func_use_lds_global: -; GFX8: ; %bb.0: -; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT: v_mov_b32_e32 v0, 0 -; GFX8-NEXT: s_mov_b32 m0, -1 -; GFX8-NEXT: ds_write_b32 v0, v0 -; GFX8-NEXT: s_mov_b64 s[0:1], s[6:7] -; GFX8-NEXT: s_trap 2 -; GFX8-NEXT: s_waitcnt lgkmcnt(0) -; GFX8-NEXT: s_setpc_b64 s[30:31] +; GFX8-SDAG-LABEL: func_use_lds_global: +; GFX8-SDAG: ; %bb.0: +; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX8-SDAG-NEXT: v_mov_b32_e32 v0, 0 +; GFX8-SDAG-NEXT: s_mov_b32 m0, -1 +; GFX8-SDAG-NEXT: ds_write_b32 v0, v0 +; GFX8-SDAG-NEXT: s_mov_b64 s[0:1], s[6:7] +; GFX8-SDAG-NEXT: s_trap 2 +; GFX8-SDAG-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31] ; -; GFX9-LABEL: func_use_lds_global: -; GFX9: ; %bb.0: -; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: v_mov_b32_e32 v0, 0 -; GFX9-NEXT: ds_write_b32 v0, v0 -; GFX9-NEXT: s_trap 2 -; GFX9-NEXT: s_waitcnt lgkmcnt(0) -; GFX9-NEXT: s_setpc_b64 s[30:31] - store float 0.0, ptr addrspace(3) @lds, align 4 +; GFX8-GISEL-LABEL: func_use_lds_global: +; GFX8-GISEL: ; %bb.0: +; GFX8-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX8-GISEL-NEXT: v_mov_b32_e32 v0, 0 +; GFX8-GISEL-NEXT: s_mov_b32 m0, -1 +; GFX8-GISEL-NEXT: s_mov_b64 s[0:1], s[6:7] +; GFX8-GISEL-NEXT: s_trap 2 +; GFX8-GISEL-NEXT: ds_write_b32 v0, v0 +; GFX8-GISEL-NEXT: s_waitcnt lgkmcnt(0) +; GFX8-GISEL-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-SDAG-LABEL: func_use_lds_global: +; GFX9-SDAG: ; %bb.0: +; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-SDAG-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-SDAG-NEXT: ds_write_b32 v0, v0 +; GFX9-SDAG-NEXT: s_trap 2 +; GFX9-SDAG-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-GISEL-LABEL: func_use_lds_global: +; GFX9-GISEL: ; %bb.0: +; GFX9-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, 0 +; GFX9-GISEL-NEXT: s_trap 2 +; GFX9-GISEL-NEXT: ds_write_b32 v0, v0 +; GFX9-GISEL-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-GISEL-NEXT: s_setpc_b64 s[30:31] + store volatile float 0.0, ptr addrspace(3) @lds, align 4 ret void } ; ERR: warning: :0:0: in function func_use_lds_global_constexpr_cast void (): local memory global used by non-kernel function define void @func_use_lds_global_constexpr_cast() { -; GFX8-LABEL: func_use_lds_global_constexpr_cast: -; GFX8: ; %bb.0: -; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX8-NEXT: s_mov_b64 s[0:1], s[6:7] -; GFX8-NEXT: s_trap 2 -; GFX8-NEXT: s_setpc_b64 s[30:31] +; GFX8-SDAG-LABEL: func_use_lds_global_constexpr_cast: +; GFX8-SDAG: ; %bb.0: +; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX8-SDAG-NEXT: s_mov_b64 s[0:1], s[6:7] +; GFX8-SDAG-NEXT: s_trap 2 +; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31] +; +; GFX8-GISEL-LABEL: func_use_lds_global_constexpr_cast: +; GFX8-GISEL: ; %bb.0: +; GFX8-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX8-GISEL-NEXT: s_mov_b64 s[0:1], s[6:7] +; GFX8-GISEL-NEXT: s_trap 2 +; GFX8-GISEL-NEXT: flat_store_dword v[0:1], v0 +; GFX8-GISEL-NEXT: s_waitcnt vmcnt(0) +; GFX8-GISEL-NEXT: s_setpc_b64 s[30:31] +; +; GFX9-SDAG-LABEL: func_use_lds_global_constexpr_cast: +; GFX9-SDAG: ; %bb.0: +; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-SDAG-NEXT: s_trap 2 +; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31] ; -; GFX9-LABEL: func_use_lds_global_constexpr_cast: -; GFX9: ; %bb.0: -; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -; GFX9-NEXT: s_trap 2 -; GFX9-NEXT: s_setpc_b64 s[30:31] - store i32 ptrtoint (ptr addrspace(3) @lds to i32), ptr addrspace(1) undef, align 4 +; GFX9-GISEL-LABEL: func_use_lds_global_constexpr_cast: +; GFX9-GISEL: ; %bb.0: +; GFX9-GISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) +; GFX9-GISEL-NEXT: s_trap 2 +; GFX9-GISEL-NEXT: global_store_dword v[0:1], v0, off +; GFX9-GISEL-NEXT: s_waitcnt vmcnt(0) +; GFX9-GISEL-NEXT: s_setpc_b64 s[30:31] + store volatile i32 ptrtoint (ptr addrspace(3) @lds to i32), ptr addrspace(1) poison, align 4 ret void } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; GFX8: {{.*}} +; GFX9: {{.*}} -- 2.7.4