summaryrefslogtreecommitdiff
path: root/src/GNUmakefile
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-25 11:20:24 -0700
committerScott Gasch <[email protected]>2026-10-25 11:20:41 -0700
commitc1e8cefc7bf0c4017dda24b0486806ce3304a7ae (patch)
treeda5cfe55fe0af85c615db8c68320d53d1f67cf5c /src/GNUmakefile
parent455accb4cbb1777cb553b6d75136521c6b8d1c01 (diff)
Remove the x86/x64 assembly backend; use compiler intrinsics insteadHEADmaster
x86.asm/x64.asm were already mostly dead weight -- GetAttacks's real asm body was retired 2026-09-06 (section 7 of board_representation/MIGRATION.md), and LockDecrement/ CanUseParallelOpcodes/ParallelCompareUlong/ParallelCompareVector had zero remaining callers (confirmed by grep before deleting anything). What was still real and load-bearing: - CountBits/FirstBit/LastBit: popcount/bsf/bsr CDECL calls. Already had faster, compiler-intrinsic replacements sitting right next to them in chess.h (FastCountBits/FastFirstBit/FastLastBit, via __builtin_popcountll/__builtin_ctzll/__builtin_clzll with -mpopcnt) that per-file #ifndef CROUTINES blocks in board.c/eval.c/generate.c/ probe.c/recogn.c were already redirecting individual call sites to. Promoted that redirect to the plain names unconditionally (#define CountBits FastCountBits etc. in chess.h) and dropped the now-always-true CROUTINES guards in those five files -- CountBits' real asm body was a Kernighan bit-clearing loop (~23 cycles/op per gmake TEST=1's own benchmark), not even O(1), so this is strictly faster as well as removing the toolchain dependency. - LockCompareExchange/LockIncrement: real atomics backing AcquireSpinLock/TryAcquireSpinLock/ReleaseSpinLock (util.c) and the move-pool allocator (gamelist.c). Replaced with static inline wrappers over __sync_val_compare_and_swap/__sync_add_and_fetch -- same CAS/atomic-add semantics as the retired `lock cmpxchg`/ `lock xadd` instructions. Removes the yasm/nasm build dependency entirely: GNUmakefile's NASM/NASMFLAGS variables, the CROUTINES flag, the .asm->.o build rule, and x86.o/x64.o from every OBJS list. x86.asm/x64.asm deleted outright (git history keeps them if ever needed again). The ASM=1 debug mode (-S -fverbose-asm, a C-compiler assembly-listing dump, unrelated to the deleted files despite the similar name) is untouched. Verified: clean build with no yasm/nasm invocation anywhere in the log, a clean DEBUG=1 TEST=1 self-test run, and node-count parity against the previous commit on all three curated suites at sd10 (4,003,856 / 22,308,015 / 26,868,016 on both sides) -- confirms this is a pure substitution with zero behavioral change, not just "doesn't crash." Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/GNUmakefile')
-rw-r--r--src/GNUmakefile44
1 files changed, 5 insertions, 39 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 717006b..6970b45 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -18,21 +18,9 @@
# TREEDUMP=1: dump a flat MOVE/RESULT search-tree trace to
# treedump.log (see TREEDUMP_FORMAT.md)
# OSX=1: build for an Intel-based Apple Mac (omit this for FreeBSD/Linux)
-# USE_READLINE=1: link against the GNU readline library
+# DISABLE_READLINE=1: opt out of linking the GNU readline library
+# (default on; see GNUmakefile's own comment at that block)
# SIXTYFOUR=1: make an X64 binary
-# CROUTINES=1: use the C versions of the asm routines [slower]
-# GETATTACKS_BITBOARD=1: use the bbPieces/bbPawns-backed _GetAttacksBB
-# instead of the asm/CROUTINES GetAttacks -- see
-# board_representation/MIGRATION.md section 6
-# DISABLE_BITBOARD_MOVEGEN=1: opt back into the mailbox move
-# generator/escapes/ExposesCheck/IsAttacked implementations -- the
-# nine GENERATE_*_BITBOARD/EXPOSESCHECK_BITBOARD/ISATTACKED_BITBOARD
-# toggles (board_representation/MOVEGEN_MIGRATION.md) are on by
-# default as of the 2026-09-04 correctness/no-regression sweep
-# (perft, move-set comparison harness, sd10 curated-suite parity,
-# match_play.py). The mailbox code is still fully present and
-# compiled either way -- this flag only flips which side of each
-# macro-swap wins, it doesn't remove anything.
# GPROF=1: instrument with -pg for gprof(1)-based profiling (see
# PROFILE.md) -- root-free on both FreeBSD and Linux, unlike
# hardware-counter-based profiling (pmcstat/perf). Requires a
@@ -44,7 +32,6 @@
#
CC = clang
CXX = clang++
-NASM = yasm
# Default to a 64-bit build -- 32-bit clang isn't available in this
# environment anyway (see CLAUDE.md). Still overridable in principle
@@ -54,19 +41,8 @@ NASM = yasm
SIXTYFOUR ?= 1
ifdef OSX
LIBRARIES = -pthread -lc
- ifdef SIXTYFOUR
- $(warning you will need to use yasm for now to get x64 on OSX)
- NASMFLAGS = -f macho64 -dOSX -d_X64_
- else
- NASMFLAGS = -f macho -dOSX
- endif
else
- LIBRARIES = -pthread -lc -lstdc++
- ifdef SIXTYFOUR
- NASMFLAGS = -f elf64 -d__GNUC__
- else
- NASMFLAGS = -f elf -d__GNUC__
- endif
+ LIBRARIES = -pthread -lc -lstdc++
endif
RM = /bin/rm
@@ -144,14 +120,8 @@ ifdef SIXTYFOUR
# than the old CDECL-call CountBits, but not the ~1-3 cycle single
# instruction the "fast" eval.c wrappers were assumed to get).
PROFILE += -m64 -mpopcnt
- NASMFLAGS += -d_X64_
else
PROFILE += -m32
- NASMFLAGS += -d_X86_
-endif
-
-ifdef CROUTINES
- PROFILE += -DCROUTINES
endif
# 2026-10-25: bitboard move generation is no longer optional -- this
@@ -397,11 +367,11 @@ FATHOM_CFLAGS = -std=gnu99 -O2 -Ifathom $(filter -m32 -m64,$(PROFILE))
# ---> .o, not .c! <---
#
OBJS = main.o root.o search.o searchsup.o draw.o dynamic.o \
- hash.o eval.o x86.o pawnhash.o bitboard.o \
+ hash.o eval.o pawnhash.o bitboard.o \
generate.o see.o move.o movesup.o command.o script.o \
input.o vars.o util.o unix.o gamelist.o mersenne.o \
sig.o piece.o ics.o san.o fen.o book.o bench.o board.o \
- data.o probe.o fathom.o recogn.o list.o x64.o \
+ data.o probe.o fathom.o recogn.o list.o \
nnuefeatures.o nnueaccum.o nnueeval.o fhmodel.o
ifdef TEST
@@ -429,7 +399,6 @@ endif
.SUFFIXES: .c .o
.SUFFIXES: .cpp .o
-.SUFFIXES: .asm .o
.PHONY: all
all: $(BINARY)
@@ -447,9 +416,6 @@ fathom.o: fathom/tbprobe.c fathom/tbchess.c fathom/tbconfig.h fathom/tbprobe.h f
%.o: %.cpp $(HEADERS)
$(CXX) $(CFLAGS) -c -w $< -o $@
-%.o: %.asm $(HEADERS)
- $(NASM) $(NASMFLAGS) -o $@ $<
-
.PHONY: release
release:
$(MAKE) -j5 MP=1 GENETIC=1