-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (71 loc) · 1.52 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
CORRELATE_SRC="src/correlate.c"
CORRELATE_SCALAR_BUILD="src/correlate-scalar.wasm"
CORRELATE_SIMD_BUILD="src/correlate-simd.wasm"
default: embed-wasm
clean:
rm -f src/*.wasm
# requires: llvm, clang, llc, binaryen
correlate-scalar:
@ clang \
--target=wasm32 \
-nostdlib \
-flto \
-Wl,--import-memory \
-Wl,--export=correlate \
-Wl,--export=__heap_base \
-Wl,--no-entry \
-Wl,--lto-O3 \
-O3 \
-o "$(CORRELATE_SCALAR_BUILD)" \
$(CORRELATE_SRC)
@ wasm-opt \
-lmu \
-O4 \
--reorder-functions \
--reorder-locals \
--coalesce-locals \
--optimize-instructions \
--optimize-added-constants-propagate \
--const-hoisting \
--simplify-globals \
--simplify-locals \
--strip-producers \
--vacuum \
--converge \
$(CORRELATE_SCALAR_BUILD) \
-o $(CORRELATE_SCALAR_BUILD)
correlate-simd:
@ clang \
--target=wasm32 \
-nostdlib \
-msimd128 \
-DWASM_SIMD \
-flto \
-Wl,--import-memory \
-Wl,--export=correlate \
-Wl,--export=__heap_base \
-Wl,--no-entry \
-Wl,--lto-O3 \
-O3 \
-o "$(CORRELATE_SIMD_BUILD)" \
$(CORRELATE_SRC)
@ wasm-opt \
-lmu \
-O4 \
--reorder-functions \
--reorder-locals \
--coalesce-locals \
--optimize-instructions \
--optimize-added-constants-propagate \
--const-hoisting \
--simplify-globals \
--simplify-locals \
--strip-producers \
--vacuum \
--converge \
$(CORRELATE_SIMD_BUILD) \
-o $(CORRELATE_SIMD_BUILD)
embed-wasm: correlate-scalar correlate-simd
SIMD=${CORRELATE_SIMD_BUILD} \
SCALAR=${CORRELATE_SCALAR_BUILD} \
npm run build