gcc, as, AVX, binutils and MacOS X 10.7
vincent habchi
vince at macports.org
Mon Oct 3 12:50:05 PDT 2011
Ok, finally I figured out a way to compile AVX instructions. But it is somewhat crooked. The old ‘as’ assembler in /usr/bin/as must be discarded and replaced by this script, that uses the clang assembler:
#!/bin/sh
HAS_INPUT_FILE=0
ARGS=$@
while [ $# -ne 0 ]; do
ARG=$1
# Skip options
if [ $ARG == "-arch" ] || [ $ARG == "-o" ]; then
# Skip next token
shift
shift
continue
fi
if [ `echo $ARG | head -c1` == "-" ]; then
shift
continue
fi
HAS_INPUT_FILE=1
break
done
if [ $HAS_INPUT_FILE -eq 1 ]; then
clang -c -x assembler $ARGS
else
clang -c -x assembler $ARGS -
fi
Obviously, since this is a shell script, the assembly phase is slowed down. But it seems to work, at least it compiles AVX assembly properly (gcc-mp-4.5 avx.s works, and I have even recompiled gcc45 with the script as assembler).
Well, I have filed a RADAR asking Apple to give us an assembler that supports AVX. We’ll see.
Cheers
Vincent
More information about the macports-dev
mailing list