Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/dev/aarch64_opt/src/Makefile

raw symbols SCIP
1 # Copyright (c) The mldsa-native project authors
2 # SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3
4 ######
5 # To run, see the README.md file
6 ######
7 .PHONY: all clean
8
9 # ISA to optimize for
10 TARGET_ISA=Arm_AArch64
11
12 # MicroArch target to optimize for
13 # Changing this to Arm_Cortex_A55 results in significantly better performance
14 # on the Cortex-A55, but may result in worse performance on other CPUs.
15 TARGET_MICROARCH=Arm_Neoverse_N1_experimental
16
17 SLOTHY_EXTRA_FLAGS ?=
18
19 SLOTHY_FLAGS=-c sw_pipelining.enabled=true \
20 -c inputs_are_outputs \
21 -c sw_pipelining.minimize_overlapping=False \
22 -c sw_pipelining.allow_post \
23 -c variable_size \
24 -c constraints.stalls_first_attempt=64 \
25 $(SLOTHY_EXTRA_FLAGS)
26
27 SLOTHY_FLAGS_SPLIT= -c inputs_are_outputs \
28 -c variable_size \
29 -c constraints.stalls_first_attempt=64 \
30 -c split_heuristic=true \
31 -c split_heuristic_repeat=2 \
32 -c sw_pipelining.enabled=true \
33 -c sw_pipelining.halving_heuristic=True \
34 $(SLOTHY_EXTRA_FLAGS)
35
36 # For kernels which stash callee-saved v8-v15 but don't stash callee-saved GPRs x19-x30.
37 # Allow SLOTHY to use all V-registers, but only caller-saved GPRs.
38 RESERVE_X_ONLY_FLAG=-c reserved_regs="[x18--x30,sp]"
39
40 # Used for kernels which don't stash callee-saved registers.
41 # Restrict SLOTHY to caller-saved registers.
42 RESERVE_ALL_FLAG=-c reserved_regs="[x18--x30,sp,v8--v15]"
43
44 all: ntt.S \
45 intt.S \
46 mld_polyvecl_pointwise_acc_montgomery_l4.S \
47 mld_polyvecl_pointwise_acc_montgomery_l5.S \
48 mld_polyvecl_pointwise_acc_montgomery_l7.S \
49 pointwise_montgomery.S \
50 poly_caddq_asm.S \
51 poly_chknorm_asm.S \
52 poly_decompose_32_asm.S \
53 poly_decompose_88_asm.S \
54 poly_use_hint_32_asm.S \
55 poly_use_hint_88_asm.S \
56 polyz_unpack_17_asm.S \
57 polyz_unpack_19_asm.S \
58 rej_uniform_asm.S \
59 rej_uniform_eta2_asm.S \
60 rej_uniform_eta4_asm.S
61
62 # These units explicitly save and restore registers v8-v15, so SLOTHY can freely use
63 # those registers.
64 ntt.S: ../../aarch64_clean/src/ntt.S
65 # optimize first loop in one go and write to temp file
66 $(eval TMPFILE := $(shell mktemp))
67 slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $< -o $(TMPFILE) -l ntt_layer123_start $(SLOTHY_FLAGS) $(RESERVE_X_ONLY_FLAG)
68 # optimize second loop using split heuristic
69 slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $(TMPFILE) -o $@ -l ntt_layer45678_start $(SLOTHY_FLAGS_SPLIT) -c split_heuristic_factor=1.5 $(RESERVE_X_ONLY_FLAG)
70
71 # Copy remaining files without optimization for now
72 intt.S: ../../aarch64_clean/src/intt.S
73 # optimize first loop in one go and write to temp file
74 $(eval TMPFILE := $(shell mktemp))
75 slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $< -o $(TMPFILE) -l intt_layer5678_start $(SLOTHY_FLAGS) -c reserved_regs="[x0,x18--x30,sp]"
76 # optimize second loop using split heuristic
77 slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $(TMPFILE) -o $@ -l intt_layer1234_start $(SLOTHY_FLAGS_SPLIT) -c split_heuristic_factor=2.5 $(RESERVE_X_ONLY_FLAG)
78
79 mld_polyvecl_pointwise_acc_montgomery_l4.S: ../../aarch64_clean/src/mld_polyvecl_pointwise_acc_montgomery_l4.S
80 cp $< $@
81
82 mld_polyvecl_pointwise_acc_montgomery_l5.S: ../../aarch64_clean/src/mld_polyvecl_pointwise_acc_montgomery_l5.S
83 cp $< $@
84
85 mld_polyvecl_pointwise_acc_montgomery_l7.S: ../../aarch64_clean/src/mld_polyvecl_pointwise_acc_montgomery_l7.S
86 cp $< $@
87
88 pointwise_montgomery.S: ../../aarch64_clean/src/pointwise_montgomery.S
89 cp $< $@
90
91 poly_caddq_asm.S: ../../aarch64_clean/src/poly_caddq_asm.S
92 cp $< $@
93
94 poly_chknorm_asm.S: ../../aarch64_clean/src/poly_chknorm_asm.S
95 cp $< $@
96
97 poly_decompose_32_asm.S: ../../aarch64_clean/src/poly_decompose_32_asm.S
98 cp $< $@
99
100 poly_decompose_88_asm.S: ../../aarch64_clean/src/poly_decompose_88_asm.S
101 cp $< $@
102
103 poly_use_hint_32_asm.S: ../../aarch64_clean/src/poly_use_hint_32_asm.S
104 cp $< $@
105
106 poly_use_hint_88_asm.S: ../../aarch64_clean/src/poly_use_hint_88_asm.S
107 cp $< $@
108
109 polyz_unpack_17_asm.S: ../../aarch64_clean/src/polyz_unpack_17_asm.S
110 cp $< $@
111
112 polyz_unpack_19_asm.S: ../../aarch64_clean/src/polyz_unpack_19_asm.S
113 cp $< $@
114
115 rej_uniform_asm.S: ../../aarch64_clean/src/rej_uniform_asm.S
116 cp $< $@
117
118 rej_uniform_eta2_asm.S: ../../aarch64_clean/src/rej_uniform_eta2_asm.S
119 cp $< $@
120
121 rej_uniform_eta4_asm.S: ../../aarch64_clean/src/rej_uniform_eta4_asm.S
122 cp $< $@
123
124 clean:
125 -$(RM) -rf *.S