diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-21 14:34:12 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-22 14:28:48 +0200 |
| commit | a27f3e3fd1e4d16160f8885b6b06665b5319f56c (patch) | |
| tree | b033935392cbadf6f85d2dbddf433a88e323aeeb /tests/codegen/atomicptr.rs | |
| parent | ed93c1783b404d728d4809973a0550eb33cd293f (diff) | |
| download | rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.tar.gz rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.zip | |
Rename `tests/codegen` into `tests/codegen-llvm`
Diffstat (limited to 'tests/codegen/atomicptr.rs')
| -rw-r--r-- | tests/codegen/atomicptr.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs deleted file mode 100644 index 4819af40ca2..00000000000 --- a/tests/codegen/atomicptr.rs +++ /dev/null @@ -1,36 +0,0 @@ -// LLVM does not support some atomic RMW operations on pointers, so inside codegen we lower those -// to integer atomics, surrounded by casts to and from integer type. -// This test ensures that we do the round-trip correctly for AtomicPtr::fetch_byte_add, and also -// ensures that we do not have such a round-trip for AtomicPtr::swap, because LLVM supports pointer -// arguments to `atomicrmw xchg`. - -//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -#![crate_type = "lib"] -#![feature(strict_provenance_atomic_ptr)] - -use std::ptr::without_provenance_mut; -use std::sync::atomic::AtomicPtr; -use std::sync::atomic::Ordering::Relaxed; - -// Portability hack so that we can say [[USIZE]] instead of i64/i32/i16 for usize. -// CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1) -#[no_mangle] -pub fn helper(_: usize) {} - -// CHECK-LABEL: @atomicptr_fetch_byte_add -#[no_mangle] -pub fn atomicptr_fetch_byte_add(a: &AtomicPtr<u8>, v: usize) -> *mut u8 { - // CHECK: %[[INTPTR:.*]] = ptrtoint ptr %{{.*}} to [[USIZE]] - // CHECK-NEXT: %[[RET:.*]] = atomicrmw add ptr %{{.*}}, [[USIZE]] %[[INTPTR]] - // CHECK-NEXT: inttoptr [[USIZE]] %[[RET]] to ptr - a.fetch_byte_add(v, Relaxed) -} - -// CHECK-LABEL: @atomicptr_swap -#[no_mangle] -pub fn atomicptr_swap(a: &AtomicPtr<u8>, ptr: *mut u8) -> *mut u8 { - // CHECK-NOT: ptrtoint - // CHECK: atomicrmw xchg ptr %{{.*}}, ptr %{{.*}} monotonic - // CHECK-NOT: inttoptr - a.swap(ptr, Relaxed) -} |
