about summary refs log tree commit diff
path: root/tests/codegen-llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-09-07 17:12:08 +0000
committerbors <bors@rust-lang.org>2025-09-07 17:12:08 +0000
commit23718020b12d7e5a54f82a19910e8356ee719667 (patch)
treec63a5a8414c09b3db00c53e3694b06c36233f6ea /tests/codegen-llvm
parent55b9b4d1e1bb5b46c04237a2fb2f8a85f39ef97d (diff)
parent15c6585e5c5352746302737c0a55de96d9514fd3 (diff)
downloadrust-23718020b12d7e5a54f82a19910e8356ee719667.tar.gz
rust-23718020b12d7e5a54f82a19910e8356ee719667.zip
Auto merge of #146148 - Flakebi:global-addrspace-test, r=Mark-Simulacrum
Add amdgpu test for addrspacecasting global vars and the gpu-kernel calling convention

Add two tests that can now be added, as the amdgpu is merged.

- Global variables are casted to the default address space since rust-lang/rust#135026
- gpu-kernel calling convention, translatos to amdgpu_kernel rust-lang/rust#135047

Tracking issue: rust-lang/rust#135024
Diffstat (limited to 'tests/codegen-llvm')
-rw-r--r--tests/codegen-llvm/amdgpu-addrspacecast.rs9
-rw-r--r--tests/codegen-llvm/gpu-kernel-abi.rs5
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/codegen-llvm/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs
index 7fe630a7efa..829133de00d 100644
--- a/tests/codegen-llvm/amdgpu-addrspacecast.rs
+++ b/tests/codegen-llvm/amdgpu-addrspacecast.rs
@@ -16,3 +16,12 @@ pub fn ref_of_local(f: fn(&i32)) {
     let i = 0;
     f(&i);
 }
+
+// CHECK-LABEL: @ref_of_global
+// CHECK: addrspacecast (ptr addrspace(1) @I to ptr)
+#[no_mangle]
+pub fn ref_of_global(f: fn(&i32)) {
+    #[no_mangle]
+    static I: i32 = 0;
+    f(&I);
+}
diff --git a/tests/codegen-llvm/gpu-kernel-abi.rs b/tests/codegen-llvm/gpu-kernel-abi.rs
index 8ac376d9338..d5a357ef655 100644
--- a/tests/codegen-llvm/gpu-kernel-abi.rs
+++ b/tests/codegen-llvm/gpu-kernel-abi.rs
@@ -1,7 +1,9 @@
 // Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions.
 
 //@ add-core-stubs
-//@ revisions: nvptx
+//@ revisions: amdgpu nvptx
+//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900
+//@ [amdgpu] needs-llvm-components: amdgpu
 //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda
 //@ [nvptx] needs-llvm-components: nvptx
 #![feature(no_core, lang_items, abi_gpu_kernel)]
@@ -10,6 +12,7 @@
 extern crate minicore;
 use minicore::*;
 
+// amdgpu: define amdgpu_kernel void @fun(i32
 // nvptx: define ptx_kernel void @fun(i32
 #[no_mangle]
 pub extern "gpu-kernel" fn fun(_: i32) {}