about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlakebi <flakebi@t-online.de>2025-09-03 08:29:52 +0200
committerFlakebi <flakebi@t-online.de>2025-09-03 08:40:51 +0200
commit485bdafdcfb340e74b7342d716b2135d4c6c8ca1 (patch)
tree47a3776c1f9d4af90aa16f874fffcb7c5a0cdf2a
parent94722cabf4983abcbe5088c1b8e81517ba2a7126 (diff)
downloadrust-485bdafdcfb340e74b7342d716b2135d4c6c8ca1.tar.gz
rust-485bdafdcfb340e74b7342d716b2135d4c6c8ca1.zip
Add test for addrspacecasting global vars
Global variables are casted to the default address space works,
as the amdgpu target is now merged, a test can be added.
-rw-r--r--tests/auxiliary/minicore.rs9
-rw-r--r--tests/codegen-llvm/amdgpu-addrspacecast.rs9
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs
index da880100a10..4f4c653cb46 100644
--- a/tests/auxiliary/minicore.rs
+++ b/tests/auxiliary/minicore.rs
@@ -179,7 +179,14 @@ impl Add<isize> for isize {
 
 #[lang = "sync"]
 trait Sync {}
-impl Sync for u8 {}
+impl_marker_trait!(
+    Sync => [
+        char, bool,
+        isize, i8, i16, i32, i64, i128,
+        usize, u8, u16, u32, u64, u128,
+        f16, f32, f64, f128,
+    ]
+);
 
 #[lang = "drop_in_place"]
 fn drop_in_place<T>(_: *mut T) {}
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);
+}