Skip to content

Commit 58e7001

Browse files
committed
nix-trace: compile with SIMD
1 parent cd6d460 commit 58e7001

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

nix-trace/Makefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22

33
DESTDIR := ./build
44

5-
BLAKE3_FLAGS := \
6-
-I "${BLAKE3_CSRC}" \
7-
-DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 \
8-
-DBLAKE3_USE_NEON=0 \
9-
$(addprefix ${BLAKE3_CSRC}/,blake3.c blake3_dispatch.c blake3_portable.c)
5+
BLAKE3_SRCS := blake3.c blake3_dispatch.c blake3_portable.c
6+
BLAKE3_FLAGS := -I $(BLAKE3_CSRC)
7+
ifneq ($(filter aarch64-%, $(system)),)
8+
BLAKE3_SRCS += blake3_neon.c
9+
else
10+
BLAKE3_FLAGS += -DBLAKE3_USE_NEON=0
11+
endif
12+
ifneq ($(filter x86_64-%, $(system)),)
13+
BLAKE3_SRCS += blake3_sse2_x86-64_unix.S \
14+
blake3_sse41_x86-64_unix.S \
15+
blake3_avx2_x86-64_unix.S \
16+
blake3_avx512_x86-64_unix.S
17+
else
18+
BLAKE3_FLAGS += -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 \
19+
-DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512
20+
endif
1021

11-
${DESTDIR}/trace-nix.so: trace-nix.c
12-
@mkdir -p ${DESTDIR}
13-
${CC} -fPIC -shared -o $@ $< ${BLAKE3_FLAGS}
22+
$(DESTDIR)/trace-nix.so: trace-nix.c Makefile
23+
@mkdir -p $(DESTDIR)
24+
$(CC) -fPIC -shared -o $@ $< \
25+
$(BLAKE3_FLAGS) $(addprefix $(BLAKE3_CSRC)/, $(BLAKE3_SRCS))
1426

1527
test: build/trace-nix.so
1628
./test.sh

0 commit comments

Comments
 (0)