Add ARM floating point ABI detection

pull/239/head
Jeffrey Walton 2016-07-20 09:49:06 -04:00
parent 9cdeb3ce8e
commit e7e61e8f9e
1 changed files with 54 additions and 25 deletions

View File

@ -522,6 +522,10 @@ if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then
HAVE_ARM_NEON=$(echo "$ARM_FEATURES" | "$GREP" -i -c 'neon')
fi
if [[ (-z "$HAVE_ARM_ASIMD") ]]; then
HAVE_ARM_ASIMD=$(echo "$ARM_FEATURES" | "$GREP" -i -c 'asimd')
fi
if [[ (-z "$HAVE_ARM_CRYPTO") ]]; then
HAVE_ARM_CRYPTO=$(echo "$ARM_FEATURES" | "$EGREP" -i -c '(aes|pmull|sha1|sha2)')
fi
@ -609,7 +613,9 @@ if [[ "$IS_ARM64" -ne "0" ]]; then
elif [[ "$IS_ARM32" -ne "0" ]]; then
echo "IS_ARM32: $IS_ARM32" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_ARMV7A" -ne "0" ]]; then
if [[ "$HAVE_ARMV7" -ne "0" ]]; then
echo "HAVE_ARMV7: $HAVE_ARMV7" | tee -a "$TEST_RESULTS"
elif [[ "$HAVE_ARMV7A" -ne "0" ]]; then
echo "HAVE_ARMV7A: $HAVE_ARMV7A" | tee -a "$TEST_RESULTS"
elif [[ "$HAVE_ARMV8A" -ne "0" ]]; then
echo "HAVE_ARMV8A: $HAVE_ARMV8A" | tee -a "$TEST_RESULTS"
@ -623,6 +629,9 @@ fi
if [[ "$HAVE_ARM_VFPV4" -ne "0" ]]; then
echo "HAVE_ARM_VFPV4: $HAVE_ARM_VFPV4" | tee -a "$TEST_RESULTS"
fi
if [[ ("$HAVE_ARM_ASIMD" -ne "0") ]]; then
echo "HAVE_ARM_ASIMD: $HAVE_ARM_ASIMD" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_ARM_CRC" -ne "0" ]]; then
echo "HAVE_ARM_CRC: $HAVE_ARM_CRC" | tee -a "$TEST_RESULTS"
fi
@ -825,33 +834,53 @@ if [[ "$?" -eq "0" ]]; then
DEPRECATED_CXXFLAGS+=("-Wno-deprecated-declarations")
fi
# Add to exercise ARMv7, ARMv7-a, VFPU and NEON more thoroughly
if [[ ("$IS_ARM32" -ne "0") ]]; then
if [[ ("$HAVE_ARMV7A" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv7-a ")
else
PLATFORM_CXXFLAGS+=("-march=armv7 ")
# Please, someone put an end to the madness of determining Features, ABI, hard floats and soft floats...
if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then
# Add to exercise ARMv7, ARMv7-a, VFPU and NEON more thoroughly
if [[ ("$IS_ARM32" -ne "0") ]]; then
if [[ ("$HAVE_ARMV7A" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv7-a ")
else
PLATFORM_CXXFLAGS+=("-march=armv7 ")
fi
# http://community.arm.com/groups/tools/blog/2013/04/15/arm-cortex-a-processors-and-gcc-command-lines
# These may need more tuning. If it was easy to get the CPU brand name, like Cortex-A9, then we could
# be fairly certain of the FPU and ABI flags. But we can't easily get a CPU name, so we suffer through it.
if [[ ("$HAVE_ARM_NEON" -ne "0" && "$HAVE_ARM_VFPV4" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon-vfpv4 ")
elif [[ ("$HAVE_ARM_NEON" -ne "0" && "$HAVE_ARM_VFPV3" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon-fp16 ")
elif [[ ("$HAVE_ARM_NEON" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon ")
elif [[ ("$HAVE_ARM_VFPV4" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv4-d16 ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv3-d16 ")
fi
fi
if [[ ("$HAVE_ARM_NEON" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon ")
elif [[ ("$HAVE_ARM_VFPV4" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv4-d16 ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv3-d16 ")
else
PLATFORM_CXXFLAGS+=("-mfpu=vfpv2 ")
fi
fi
# Add to exercise ARMv8 more thoroughly. NEON is baked into the CPU asimd flag.
if [[ ("$IS_ARM64" -ne "0") ]]; then
if [[ ("$HAVE_ARM_CRC" -ne "0" && "$HAVE_ARM_CRYPTO" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crc+crypto ")
elif [[ ("$HAVE_ARM_CRC" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crc ")
elif [[ ("$HAVE_ARM_CRYPTO" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crypto ")
fi
# Add to exercise ARMv8 more thoroughly. NEON is baked into the CPU asimd flag.
if [[ ("$IS_ARM64" -ne "0") ]]; then
if [[ ("$HAVE_ARM_CRC" -ne "0" && "$HAVE_ARM_CRYPTO" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crc+crypto ")
elif [[ ("$HAVE_ARM_CRC" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crc ")
elif [[ ("$HAVE_ARM_CRYPTO" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-march=armv8-a+crypto ")
if [[ ("$HAVE_ARM_ASIMD" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon-fp-armv8 ")
fi
fi
ARM_HARD_FLOAT=$("$CXX" -v 2>&1 | "$GREP" 'Target' | "$EGREP" -i -c '(armhf|gnueabihf)')
if [[ ("$ARM_HARD_FLOAT" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfloat-abi=hard ")
else
PLATFORM_CXXFLAGS+=("-mfloat-abi=softfp ")
fi
fi