Skip to content

Commit 485bdaf

Browse files
committed
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.
1 parent 94722ca commit 485bdaf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/auxiliary/minicore.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ impl Add<isize> for isize {
179179

180180
#[lang = "sync"]
181181
trait Sync {}
182-
impl Sync for u8 {}
182+
impl_marker_trait!(
183+
Sync => [
184+
char, bool,
185+
isize, i8, i16, i32, i64, i128,
186+
usize, u8, u16, u32, u64, u128,
187+
f16, f32, f64, f128,
188+
]
189+
);
183190

184191
#[lang = "drop_in_place"]
185192
fn drop_in_place<T>(_: *mut T) {}

tests/codegen-llvm/amdgpu-addrspacecast.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@ pub fn ref_of_local(f: fn(&i32)) {
1616
let i = 0;
1717
f(&i);
1818
}
19+
20+
// CHECK-LABEL: @ref_of_global
21+
// CHECK: addrspacecast (ptr addrspace(1) @I to ptr)
22+
#[no_mangle]
23+
pub fn ref_of_global(f: fn(&i32)) {
24+
#[no_mangle]
25+
static I: i32 = 0;
26+
f(&I);
27+
}

0 commit comments

Comments
 (0)