summaryrefslogtreecommitdiff
path: root/wasm2c/benchmarks/dhrystone/Makefile
diff options
context:
space:
mode:
authorShravan Narayan <shravanrn@gmail.com>2024-06-26 11:30:44 -0500
committerGitHub <noreply@github.com>2024-06-26 09:30:44 -0700
commit0e871afa4aaac9fe0b1f00cb42a59be666657a06 (patch)
tree22c449953033d0ea98200d9117c11419054a762e /wasm2c/benchmarks/dhrystone/Makefile
parentf820d171654de2dcb8cbf7078b4c98336c8e3c69 (diff)
downloadwabt-0e871afa4aaac9fe0b1f00cb42a59be666657a06.tar.gz
wabt-0e871afa4aaac9fe0b1f00cb42a59be666657a06.tar.bz2
wabt-0e871afa4aaac9fe0b1f00cb42a59be666657a06.zip
wasm2c: Segue optimization for modules with a single unshared memory (#2395)
Diffstat (limited to 'wasm2c/benchmarks/dhrystone/Makefile')
-rw-r--r--wasm2c/benchmarks/dhrystone/Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/wasm2c/benchmarks/dhrystone/Makefile b/wasm2c/benchmarks/dhrystone/Makefile
new file mode 100644
index 00000000..b7af5d4b
--- /dev/null
+++ b/wasm2c/benchmarks/dhrystone/Makefile
@@ -0,0 +1,38 @@
+WABT_ROOT=../../..
+CC=clang
+CFLAGS=-I$(WABT_ROOT)/wasm2c -I $(WABT_ROOT)/third_party/uvwasi/include/ -O3
+CFLAGS_SEGUE=-DWASM_RT_ALLOW_SEGUE=1 -mfsgsbase
+LDFLAGS=-L$(WABT_ROOT)/build/_deps/libuv-build -L$(WABT_ROOT)/build/third_party/uvwasi
+LDLIBS=-luvwasi_a -luv_a -lm
+
+all: benchmark
+
+clean:
+ rm -rf dhrystone dhrystone.wasm dhrystone.c dhrystone.h
+
+dhrystone.wasm: src/dhry_1.c src/dhry_2.c
+ /opt/wasi-sdk/bin/clang -O3 $^ -o $@
+
+dhrystone.c: dhrystone.wasm $(WABT_ROOT)/bin/wasm2c
+ $(WABT_ROOT)/bin/wasm2c $< -o $@ --disable-simd
+
+dhrystone_native: src/dhry_1.c src/dhry_2.c
+ clang -O3 $^ -o $@
+
+dhrystone: main.c dhrystone.c $(WABT_ROOT)/wasm2c/wasm-rt-impl.c $(WABT_ROOT)/wasm2c/wasm-rt-mem-impl.c
+ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@ $(LDLIBS)
+
+dhrystone_segue: main.c dhrystone.c $(WABT_ROOT)/wasm2c/wasm-rt-impl.c $(WABT_ROOT)/wasm2c/wasm-rt-mem-impl.c
+ $(CC) $(LDFLAGS) $(CFLAGS) $(CFLAGS_SEGUE) $^ -o $@ $(LDLIBS)
+
+benchmark: dhrystone_native dhrystone dhrystone_segue
+ @echo "Starting Dhrystone benchmark. (Smaller number is better)"
+ @sleep 2
+ @echo "Native"
+ @./dhrystone_native | grep "one run through Dhrystone"
+ @sleep 2
+ @echo "Wasm"
+ @./dhrystone | grep "one run through Dhrystone"
+ @sleep 2
+ @echo "Wasm+Segue"
+ @./dhrystone_segue | grep "one run through Dhrystone"