Skip to content

Commit

Permalink
nix-trace: compile with SIMD
Browse files Browse the repository at this point in the history
  • Loading branch information
xzfc committed May 25, 2023
1 parent cd6d460 commit 58e7001
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions nix-trace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

DESTDIR := ./build

BLAKE3_FLAGS := \
-I "${BLAKE3_CSRC}" \
-DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 \
-DBLAKE3_USE_NEON=0 \
$(addprefix ${BLAKE3_CSRC}/,blake3.c blake3_dispatch.c blake3_portable.c)
BLAKE3_SRCS := blake3.c blake3_dispatch.c blake3_portable.c
BLAKE3_FLAGS := -I $(BLAKE3_CSRC)
ifneq ($(filter aarch64-%, $(system)),)
BLAKE3_SRCS += blake3_neon.c
else
BLAKE3_FLAGS += -DBLAKE3_USE_NEON=0
endif
ifneq ($(filter x86_64-%, $(system)),)
BLAKE3_SRCS += blake3_sse2_x86-64_unix.S \
blake3_sse41_x86-64_unix.S \
blake3_avx2_x86-64_unix.S \
blake3_avx512_x86-64_unix.S
else
BLAKE3_FLAGS += -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 \
-DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512
endif

${DESTDIR}/trace-nix.so: trace-nix.c
@mkdir -p ${DESTDIR}
${CC} -fPIC -shared -o $@ $< ${BLAKE3_FLAGS}
$(DESTDIR)/trace-nix.so: trace-nix.c Makefile
@mkdir -p $(DESTDIR)
$(CC) -fPIC -shared -o $@ $< \
$(BLAKE3_FLAGS) $(addprefix $(BLAKE3_CSRC)/, $(BLAKE3_SRCS))

test: build/trace-nix.so
./test.sh
Expand Down

0 comments on commit 58e7001

Please sign in to comment.