@@ -44,13 +44,20 @@ impl_else! { i8, i16, i32, i64, isize, u8, u16, u32, u64, usize }
44
44
45
45
/// AltiVec should flush subnormal inputs to zero, but QEMU seems to only flush outputs.
46
46
/// 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
+ ) ) ]
48
51
fn in_buggy_qemu ( ) -> bool {
49
52
use std:: sync:: OnceLock ;
50
53
static BUGGY : OnceLock < bool > = OnceLock :: new ( ) ;
51
54
52
55
fn add ( x : f32 , y : f32 ) -> f32 {
56
+ #[ cfg( target_arch = "powerpc" ) ]
53
57
use core:: arch:: powerpc:: * ;
58
+ #[ cfg( target_arch = "powerpc64" ) ]
59
+ use core:: arch:: powerpc64:: * ;
60
+
54
61
let array: [ f32 ; 4 ] =
55
62
unsafe { core:: mem:: transmute ( vec_add ( vec_splats ( x) , vec_splats ( y) ) ) } ;
56
63
array[ 0 ]
@@ -59,7 +66,10 @@ fn in_buggy_qemu() -> bool {
59
66
* BUGGY . get_or_init ( || add ( -1.0857398e-38 , 0. ) . is_sign_negative ( ) )
60
67
}
61
68
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
+ ) ) ]
63
73
pub fn flush_in < T : FlushSubnormals > ( x : T ) -> T {
64
74
if in_buggy_qemu ( ) {
65
75
x
@@ -68,7 +78,10 @@ pub fn flush_in<T: FlushSubnormals>(x: T) -> T {
68
78
}
69
79
}
70
80
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
+ ) ) ) ]
72
85
pub fn flush_in < T : FlushSubnormals > ( x : T ) -> T {
73
86
x. flush ( )
74
87
}
0 commit comments