posint morph code size benchmark

This commit is contained in:
Michael Sippel 2025-02-03 17:05:19 +01:00
parent e500a24d2a
commit 23b2dcaf82
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 149 additions and 57 deletions
morphisms

View file

@ -6,8 +6,26 @@ all: $(TARGETS)
lib/libmorph_%.so: src/%.c
$(CC) -O3 -shared -o $@ -fPIC -Iinclude $<
test: test.c lib/libmorph_length-prefix.so lib/libmorph_posint.so
$(CC) -O3 -L$(LIB_DIR) -o $@ -Iinclude $< -lmorph_length-prefix -lmorph_posint
posint-dec-to-hex-generated-gcc: posint-dec-to-hex-generated.c
gcc -g -Os -flto -o $@ -Iinclude $< src/length-prefix.c src/posint.c
posint-dec-to-hex-generated-clang: posint-dec-to-hex-generated.c
clang -g -Os -flto -o $@ -Iinclude $< src/length-prefix.c src/posint.c
posint-dec-to-hex-optimal-gcc: posint-dec-to-hex-optimal.c
gcc -g -Os -flto -o $@ $<
posint-dec-to-hex-optimal-clang: posint-dec-to-hex-optimal.c
clang -g -Os -flto -o $@ $<
code-size-benchmark: posint-dec-to-hex-generated-gcc \
posint-dec-to-hex-generated-clang \
posint-dec-to-hex-optimal-gcc \
posint-dec-to-hex-optimal-clang
INST_COUNT_GEN_GCC=$(shell gdb --batch -ex "file posint-dec-to-hex-generated-gcc" -ex "disassemble main" | wc -l)
INST_COUNT_GEN_CLANG=$(shell gdb --batch -ex "file posint-dec-to-hex-generated-clang" -ex "disassemble main" | wc -l)
INST_COUNT_OPT_GCC=$(shell gdb --batch -ex "file posint-dec-to-hex-optimal-gcc" -ex "disassemble main" | wc -l)
INST_COUNT_OPT_CLANG=$(shell gdb --batch -ex "file posint-dec-to-hex-optimal-clang" -ex "disassemble main" | wc -l)
clean:
rm $(TARGETS)