Improve powerpc subnormal flushing check

This commit is contained in:
Caleb Zulawski 2023-07-22 14:18:16 -04:00
parent 5c6405ba89
commit 49e92a2918
2 changed files with 6 additions and 4 deletions

View File

@ -186,6 +186,7 @@ jobs:
# - mips64-unknown-linux-gnuabi64
target_feature: [default]
include:
- { target: powerpc-unknown-linux-gnu, target_feature: "+altivec" }
- { target: powerpc64-unknown-linux-gnu, target_feature: "+vsx" }
- { target: powerpc64le-unknown-linux-gnu, target_feature: "+vsx" }
# We should test this, but cross currently can't run it
@ -217,9 +218,6 @@ jobs:
case "${{ matrix.target_feature }}" in
default)
echo "RUSTFLAGS=" >> $GITHUB_ENV;;
native)
echo "RUSTFLAGS=-Ctarget-cpu=native" >> $GITHUB_ENV
;;
*)
echo "RUSTFLAGS=-Ctarget-feature=${{ matrix.target_feature }}" >> $GITHUB_ENV
;;

View File

@ -13,7 +13,11 @@ macro_rules! impl_float {
impl FlushSubnormals for $ty {
fn flush(self) -> Self {
let is_f32 = core::mem::size_of::<Self>() == 4;
let ppc_flush = is_f32 && cfg!(all(target_arch = "powerpc64", target_endian = "big", not(target_feature = "vsx")));
let ppc_flush = is_f32 && cfg!(all(
any(target_arch = "powerpc", all(target_arch = "powerpc64", target_endian = "big")),
target_feature = "altivec",
not(target_feature = "vsx"),
));
let arm_flush = is_f32 && cfg!(all(target_arch = "arm", target_feature = "neon"));
let flush = ppc_flush || arm_flush;
if flush && self.is_subnormal() {