Skip to content

Commit ad747af

Browse files
committed
Apply workaround to ppc64
1 parent d07ce3c commit ad747af

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

crates/test_helpers/src/subnormals.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,20 @@ impl_else! { i8, i16, i32, i64, isize, u8, u16, u32, u64, usize }
4444

4545
/// AltiVec should flush subnormal inputs to zero, but QEMU seems to only flush outputs.
4646
/// https://gitlab.com/qemu-project/qemu/-/issues/1779
47-
#[cfg(all(target_arch = "powerpc", target_feature = "altivec"))]
47+
#[cfg(all(
48+
any(target_arch = "powerpc", target_arch = "powerpc64"),
49+
target_feature = "altivec"
50+
))]
4851
fn in_buggy_qemu() -> bool {
4952
use std::sync::OnceLock;
5053
static BUGGY: OnceLock<bool> = OnceLock::new();
5154

5255
fn add(x: f32, y: f32) -> f32 {
56+
#[cfg(target_arch = "powerpc")]
5357
use core::arch::powerpc::*;
58+
#[cfg(target_arch = "powerpc64")]
59+
use core::arch::powerpc64::*;
60+
5461
let array: [f32; 4] =
5562
unsafe { core::mem::transmute(vec_add(vec_splats(x), vec_splats(y))) };
5663
array[0]
@@ -59,7 +66,10 @@ fn in_buggy_qemu() -> bool {
5966
*BUGGY.get_or_init(|| add(-1.0857398e-38, 0.).is_sign_negative())
6067
}
6168

62-
#[cfg(all(target_arch = "powerpc", target_feature = "altivec"))]
69+
#[cfg(all(
70+
any(target_arch = "powerpc", target_arch = "powerpc64"),
71+
target_feature = "altivec"
72+
))]
6373
pub fn flush_in<T: FlushSubnormals>(x: T) -> T {
6474
if in_buggy_qemu() {
6575
x
@@ -68,7 +78,10 @@ pub fn flush_in<T: FlushSubnormals>(x: T) -> T {
6878
}
6979
}
7080

71-
#[cfg(not(all(target_arch = "powerpc", target_feature = "altivec")))]
81+
#[cfg(not(all(
82+
any(target_arch = "powerpc", target_arch = "powerpc64"),
83+
target_feature = "altivec"
84+
)))]
7285
pub fn flush_in<T: FlushSubnormals>(x: T) -> T {
7386
x.flush()
7487
}

0 commit comments

Comments
 (0)