Skip to content

Commit

Permalink
test-flags: support the x86 microarchitecture levels
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Oct 26, 2023
1 parent d44e429 commit befdb28
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/check-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,23 @@ if [ ! -d "${SDE_PATH}" ]; then
mkdir -p "${SDE_PATH}"
fi

if [ -e /lib/ld-linux-x86-64.so.2 ]; then
LD=/lib/ld-linux-x86-64.so.2
else
LD=/lib64/ld-linux-x86-64.so.2
fi

NATIVE_SUPPORT=1
for FLAG in $CFLAGS; do
echo $FLAG | grep -qP '^\-m[0-9a-zA-Z\.]+$' || continue
if echo "$FLAG" | grep -q '\-march=x86-64-v[234]$' ; then
if grep -qP " ${FLAG:7} \(supported" <(${LD} --help) ; then
continue
else
NATIVE_SUPPORT=0
continue
fi
fi
echo "$FLAG" | grep -qP '^\-m[0-9a-zA-Z\.]+$' || continue
case "${FLAG:2}" in
# sse3 doesn't show up in /proc/cpuinfo (?!?!)
"sse3")
Expand All @@ -39,11 +53,11 @@ case "$COMMAND" in
;;
esac

if [ $COMMAND = 'query' ]; then
if [ "$COMMAND" = "query" ]; then
test $NATIVE_SUPPORT -eq 1
exit $?
elif [ $NATIVE_SUPPORT -eq 1 ]; then
$@
"$@"
exit $?
elif [ "$COMMAND" = "sde" ]; then
(
Expand All @@ -52,7 +66,7 @@ elif [ "$COMMAND" = "sde" ]; then
"$(dirname "$0")"/download-sde.sh "${SDE_PATH}"
fi
) 9>/tmp/sde-download.lock
"${SDE_PATH}/sde64" -${INTEL_TARGET} -- $@
"${SDE_PATH}/sde64" "-${INTEL_TARGET}" -- "$@"
exit $?
else
echo "Flags not supported, skipping"
Expand Down

0 comments on commit befdb28

Please sign in to comment.