remove simd, scalar math + compiler optimizations are good enough

This commit is contained in:
asrael 2025-11-11 12:26:22 -06:00
parent e2c7998663
commit 4d84122ef3
8 changed files with 41 additions and 509 deletions

44
pxl8.sh
View file

@ -80,26 +80,6 @@ compile_source_file() {
fi
}
detect_simd() {
local simd_flags=""
case "$(uname -m)" in
x86_64|amd64)
if $CC -mavx2 -c -x c /dev/null -o /dev/null 2>/dev/null; then
simd_flags="-mavx2 -msse2"
elif $CC -msse2 -c -x c /dev/null -o /dev/null 2>/dev/null; then
simd_flags="-msse2"
fi
;;
arm64|aarch64)
if $CC -march=armv8-a+simd -c -x c /dev/null -o /dev/null 2>/dev/null; then
simd_flags="-march=armv8-a+simd"
fi
;;
esac
echo "$simd_flags"
}
make_lib_dirs() {
mkdir -p lib/linenoise lib/fennel lib/microui/src lib/miniz
@ -294,15 +274,12 @@ for arg in "$@"; do
esac
done
SIMD_FLAGS=$(detect_simd)
if [ "$MODE" = "release" ]; then
CFLAGS="$CFLAGS -O3 -march=native -mtune=native -ffast-math -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables $SIMD_FLAGS"
CFLAGS="$CFLAGS -O3 -ffast-math -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables"
BUILDDIR="$BUILDDIR/release"
BINDIR="$BINDIR/release"
else
CFLAGS="$CFLAGS -g -O1 -DDEBUG $SIMD_FLAGS"
CFLAGS="$CFLAGS -g -O1 -DDEBUG"
BUILDDIR="$BUILDDIR/debug"
BINDIR="$BINDIR/debug"
fi
@ -354,23 +331,6 @@ case "$COMMAND" in
print_info "Compiler cache: ccache enabled"
fi
if [[ -n "$SIMD_FLAGS" ]]; then
case "$(uname -m)" in
x86_64|amd64)
if [[ "$SIMD_FLAGS" == *"mavx2"* ]]; then
print_info "SIMD: AVX2 + SSE2 enabled"
elif [[ "$SIMD_FLAGS" == *"msse2"* ]]; then
print_info "SIMD: SSE2 enabled"
fi
;;
arm64|aarch64)
print_info "SIMD: ARM NEON enabled"
;;
esac
else
print_info "SIMD: Scalar fallback"
fi
INCLUDES="-Isrc -Ilib -Ilib/microui/src -Ilib/luajit/src -Ilib/linenoise -Ilib/miniz"
COMPILE_FLAGS="$CFLAGS $INCLUDES"