Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only compile outlined-atomics intrinsics on linux #535

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 8 additions & 4 deletions testcrate/tests/lse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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));
});
}
Expand Down