Merge pull request #535 from jyn514/linux-outlined-atomics

This commit is contained in:
Amanieu d'Antras 2023-07-03 09:44:39 +01:00 committed by GitHub
commit 11c8dd8f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View file

@ -58,8 +58,8 @@ pub mod mem;
#[cfg(target_arch = "arm")]
pub mod arm;
#[cfg(all(target_arch = "aarch64", not(feature = "no-asm"),))]
pub mod aarch64;
#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm"),))]
pub mod aarch64_linux;
#[cfg(all(
kernel_user_helpers,

View file

@ -17,7 +17,9 @@ mod cas {
testcrate::fuzz_2(10000, |expected: super::int_ty!($bytes), new| {
let mut target = expected.wrapping_add(10);
assert_eq!(
unsafe { compiler_builtins::aarch64::$name::$name(expected, new, &mut target) },
unsafe {
compiler_builtins::aarch64_linux::$name::$name(expected, new, &mut target)
},
expected.wrapping_add(10),
"return value should always be the previous value",
);
@ -29,7 +31,9 @@ mod cas {
target = expected;
assert_eq!(
unsafe { compiler_builtins::aarch64::$name::$name(expected, new, &mut target) },
unsafe {
compiler_builtins::aarch64_linux::$name::$name(expected, new, &mut target)
},
expected
);
assert_eq!(target, new, "should have updated target");
@ -49,7 +53,7 @@ mod swap {
testcrate::fuzz_2(10000, |left: super::int_ty!($bytes), mut right| {
let orig_right = right;
assert_eq!(
unsafe { compiler_builtins::aarch64::$name::$name(left, &mut right) },
unsafe { compiler_builtins::aarch64_linux::$name::$name(left, &mut right) },
orig_right
);
assert_eq!(left, right);
@ -69,7 +73,7 @@ macro_rules! test_op {
let mut target = old;
let op: fn(super::int_ty!($bytes), super::int_ty!($bytes)) -> _ = $($op)*;
let expected = op(old, val);
assert_eq!(old, unsafe { compiler_builtins::aarch64::$name::$name(val, &mut target) }, "{} should return original value", stringify!($name));
assert_eq!(old, unsafe { compiler_builtins::aarch64_linux::$name::$name(val, &mut target) }, "{} should return original value", stringify!($name));
assert_eq!(expected, target, "{} should store to target", stringify!($name));
});
}