diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2023-07-22 18:33:33 -0400 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2023-07-22 18:33:33 -0400 |
| commit | ad747af0bb3f2249ec2a87b9f25f22b238dc700a (patch) | |
| tree | 6640378ed7f2281f9c100bddb699ea4a8580b02c | |
| parent | d07ce3cef9223c918ae2381fd46ff53ce0cf38b4 (diff) | |
| download | rust-ad747af0bb3f2249ec2a87b9f25f22b238dc700a.tar.gz rust-ad747af0bb3f2249ec2a87b9f25f22b238dc700a.zip | |
Apply workaround to ppc64
| -rw-r--r-- | crates/test_helpers/src/subnormals.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/test_helpers/src/subnormals.rs b/crates/test_helpers/src/subnormals.rs index 585b80bb6c7..ec0f1fb24b9 100644 --- a/crates/test_helpers/src/subnormals.rs +++ b/crates/test_helpers/src/subnormals.rs @@ -44,13 +44,20 @@ impl_else! { i8, i16, i32, i64, isize, u8, u16, u32, u64, usize } /// AltiVec should flush subnormal inputs to zero, but QEMU seems to only flush outputs. /// https://gitlab.com/qemu-project/qemu/-/issues/1779 -#[cfg(all(target_arch = "powerpc", target_feature = "altivec"))] +#[cfg(all( + any(target_arch = "powerpc", target_arch = "powerpc64"), + target_feature = "altivec" +))] fn in_buggy_qemu() -> bool { use std::sync::OnceLock; static BUGGY: OnceLock<bool> = OnceLock::new(); fn add(x: f32, y: f32) -> f32 { + #[cfg(target_arch = "powerpc")] use core::arch::powerpc::*; + #[cfg(target_arch = "powerpc64")] + use core::arch::powerpc64::*; + let array: [f32; 4] = unsafe { core::mem::transmute(vec_add(vec_splats(x), vec_splats(y))) }; array[0] @@ -59,7 +66,10 @@ fn in_buggy_qemu() -> bool { *BUGGY.get_or_init(|| add(-1.0857398e-38, 0.).is_sign_negative()) } -#[cfg(all(target_arch = "powerpc", target_feature = "altivec"))] +#[cfg(all( + any(target_arch = "powerpc", target_arch = "powerpc64"), + target_feature = "altivec" +))] pub fn flush_in<T: FlushSubnormals>(x: T) -> T { if in_buggy_qemu() { x @@ -68,7 +78,10 @@ pub fn flush_in<T: FlushSubnormals>(x: T) -> T { } } -#[cfg(not(all(target_arch = "powerpc", target_feature = "altivec")))] +#[cfg(not(all( + any(target_arch = "powerpc", target_arch = "powerpc64"), + target_feature = "altivec" +)))] pub fn flush_in<T: FlushSubnormals>(x: T) -> T { x.flush() } |
