Skip to content

Commit 191ebbb

Browse files
committed
Rerun autogen to update mlkem/* sources for PPC64Le
Signed-off-by: Hanno Becker <[email protected]>
1 parent 7d2b5dd commit 191ebbb

File tree

14 files changed

+6024
-1546
lines changed

14 files changed

+6024
-1546
lines changed

dev/ppc64le/src/arith_native_ppc64le.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2024-2025 The mlkem-native project authors
3-
* SPDX-License-Identifier: Apache-2.0
2+
* Copyright (c) The mlkem-native project authors
3+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
44
*/
55
#ifndef MLK_DEV_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H
66
#define MLK_DEV_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H

mlkem/mlkem_native.S

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@
8585
#include "mlkem/src/native/x86_64/src/rej_uniform_asm.S"
8686
#include "mlkem/src/native/x86_64/src/tomont.S"
8787
#endif /* MLK_SYS_X86_64 */
88+
#if defined(MLK_SYS_PPC64LE)
89+
#include "mlkem/src/native/ppc64le/src/intt_ppc.S"
90+
#include "mlkem/src/native/ppc64le/src/ntt_ppc.S"
91+
#include "mlkem/src/native/ppc64le/src/poly_tomont.S"
92+
#include "mlkem/src/native/ppc64le/src/reduce.S"
93+
#endif /* MLK_SYS_PPC64LE */
8894
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
8995

9096
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202)
@@ -459,7 +465,7 @@
459465
#undef MLK_NATIVE_META_H
460466
/* mlkem/src/native/ppc64le/meta.h */
461467
#undef MLK_ARITH_BACKEND_NAME
462-
#undef MLK_ARITH_BACKEND_PPC64LE_DEFAULT
468+
#undef MLK_ARITH_BACKEND_PPC64LE
463469
#undef MLK_NATIVE_PPC64LE_META_H
464470
#undef MLK_USE_NATIVE_INTT
465471
#undef MLK_USE_NATIVE_NTT

mlkem/mlkem_native.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
#include "src/native/x86_64/src/consts.c"
8585
#include "src/native/x86_64/src/rej_uniform_table.c"
8686
#endif
87+
#if defined(MLK_SYS_PPC64LE)
88+
#include "src/native/ppc64le/src/consts.c"
89+
#endif
8790
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
8891

8992
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202)
@@ -446,7 +449,7 @@
446449
#undef MLK_NATIVE_META_H
447450
/* mlkem/src/native/ppc64le/meta.h */
448451
#undef MLK_ARITH_BACKEND_NAME
449-
#undef MLK_ARITH_BACKEND_PPC64LE_DEFAULT
452+
#undef MLK_ARITH_BACKEND_PPC64LE
450453
#undef MLK_NATIVE_PPC64LE_META_H
451454
#undef MLK_USE_NATIVE_INTT
452455
#undef MLK_USE_NATIVE_NTT

mlkem/src/native/ppc64le/meta.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Identifier for this backend so that source and assembly files
1010
* in the build can be appropriately guarded. */
11-
#define MLK_ARITH_BACKEND_PPC64LE_DEFAULT
11+
#define MLK_ARITH_BACKEND_PPC64LE
1212

1313
#define MLK_ARITH_BACKEND_NAME PPC64LE_DEFAULT
1414

mlkem/src/native/ppc64le/src/arith_native_ppc64le.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2024-2025 The mlkem-native project authors
3-
* SPDX-License-Identifier: Apache-2.0
2+
* Copyright (c) The mlkem-native project authors
3+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
44
*/
55
#ifndef MLK_NATIVE_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H
66
#define MLK_NATIVE_PPC64LE_SRC_ARITH_NATIVE_PPC64LE_H

mlkem/src/native/ppc64le/src/consts.c

Lines changed: 62 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -5,151 +5,73 @@
55

66
#include "../../../common.h"
77

8-
#if defined(MLK_ARITH_BACKEND_PPC64LE_DEFAULT) && \
8+
#if defined(MLK_ARITH_BACKEND_PPC64LE) && \
99
!defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
1010

1111
#include "consts.h"
1212

13-
MLK_ALIGN const int16_t mlk_ppc_qdata[1568] = {
13+
MLK_ALIGN const int16_t mlk_ppc_qdata[] = {
1414
/* -Q */
15-
-3329, -3329, -3329, -3329, -3329, -3329, -3329, -3329,
15+
/* check-magic: -3329 == -1 * MLKEM_Q */
16+
-3329,
17+
-3329,
18+
-3329,
19+
-3329,
20+
-3329,
21+
-3329,
22+
-3329,
23+
-3329,
1624
/* QINV */
17-
-3327, -3327, -3327, -3327, -3327, -3327, -3327, -3327,
25+
/* check-magic: -3327 == pow(MLKEM_Q,-1,2^16) */
26+
-3327,
27+
-3327,
28+
-3327,
29+
-3327,
30+
-3327,
31+
-3327,
32+
-3327,
33+
-3327,
1834
/* Q */
19-
3329, 3329, 3329, 3329, 3329, 3329, 3329, 3329,
20-
/* const 20159 for reduce.S and intt */
21-
20159, 20159, 20159, 20159, 20159, 20159, 20159, 20159,
22-
/* const 1441 for intt */
23-
1441, 1441, 1441, 1441, 1441, 1441, 1441, 1441,
24-
/* for poly_tomont.S */
25-
1353, 1353, 1353, 1353, 1353, 1353, 1353, 1353,
26-
/* zetas */
27-
/* For ntt Len=128, offset 96 */
28-
-758, -758, -758, -758, -758, -758, -758, -758, -359, -359, -359, -359,
29-
-359, -359, -359, -359, -1517, -1517, -1517, -1517, -1517, -1517, -1517,
30-
-1517, 1493, 1493, 1493, 1493, 1493, 1493, 1493, 1493, 1422, 1422, 1422,
31-
1422, 1422, 1422, 1422, 1422, 287, 287, 287, 287, 287, 287, 287, 287, 202,
32-
202, 202, 202, 202, 202, 202, 202, -171, -171, -171, -171, -171, -171, -171,
33-
-171, 622, 622, 622, 622, 622, 622, 622, 622, 1577, 1577, 1577, 1577, 1577,
34-
1577, 1577, 1577, 182, 182, 182, 182, 182, 182, 182, 182, 962, 962, 962,
35-
962, 962, 962, 962, 962, -1202, -1202, -1202, -1202, -1202, -1202, -1202,
36-
-1202, -1474, -1474, -1474, -1474, -1474, -1474, -1474, -1474, 1468, 1468,
37-
1468, 1468, 1468, 1468, 1468, 1468, 573, 573, 573, 573, 573, 573, 573, 573,
38-
-1325, -1325, -1325, -1325, -1325, -1325, -1325, -1325, 264, 264, 264, 264,
39-
264, 264, 264, 264, 383, 383, 383, 383, 383, 383, 383, 383, -829, -829,
40-
-829, -829, -829, -829, -829, -829, 1458, 1458, 1458, 1458, 1458, 1458,
41-
1458, 1458, -1602, -1602, -1602, -1602, -1602, -1602, -1602, -1602, -130,
42-
-130, -130, -130, -130, -130, -130, -130, -681, -681, -681, -681, -681,
43-
-681, -681, -681, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 732, 732,
44-
732, 732, 732, 732, 732, 732, 608, 608, 608, 608, 608, 608, 608, 608, -1542,
45-
-1542, -1542, -1542, -1542, -1542, -1542, -1542, 411, 411, 411, 411, 411,
46-
411, 411, 411, -205, -205, -205, -205, -205, -205, -205, -205, -1571, -1571,
47-
-1571, -1571, -1571, -1571, -1571, -1571, 1223, 1223, 1223, 1223, 1223,
48-
1223, 1223, 1223, 652, 652, 652, 652, 652, 652, 652, 652, -552, -552, -552,
49-
-552, -552, -552, -552, -552, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
50-
1015, -1293, -1293, -1293, -1293, -1293, -1293, -1293, -1293, 1491, 1491,
51-
1491, 1491, 1491, 1491, 1491, 1491, -282, -282, -282, -282, -282, -282,
52-
-282, -282, -1544, -1544, -1544, -1544, -1544, -1544, -1544, -1544, 516,
53-
516, 516, 516, 516, 516, 516, 516, -8, -8, -8, -8, -8, -8, -8, -8, -320,
54-
-320, -320, -320, -320, -320, -320, -320, -666, -666, -666, -666, -666,
55-
-666, -666, -666, -1618, -1618, -1618, -1618, -1618, -1618, -1618, -1618,
56-
-1162, -1162, -1162, -1162, -1162, -1162, -1162, -1162, 126, 126, 126, 126,
57-
126, 126, 126, 126, 1469, 1469, 1469, 1469, 1469, 1469, 1469, 1469, -853,
58-
-853, -853, -853, -853, -853, -853, -853, -90, -90, -90, -90, -90, -90, -90,
59-
-90, -271, -271, -271, -271, -271, -271, -271, -271, 830, 830, 830, 830,
60-
830, 830, 830, 830, 107, 107, 107, 107, 107, 107, 107, 107, -1421, -1421,
61-
-1421, -1421, -1421, -1421, -1421, -1421, -247, -247, -247, -247, -247,
62-
-247, -247, -247, -951, -951, -951, -951, -951, -951, -951, -951, -398,
63-
-398, -398, -398, -398, -398, -398, -398, 961, 961, 961, 961, 961, 961, 961,
64-
961, -1508, -1508, -1508, -1508, -1508, -1508, -1508, -1508, -725, -725,
65-
-725, -725, -725, -725, -725, -725, 448, 448, 448, 448, 448, 448, 448, 448,
66-
-1065, -1065, -1065, -1065, -1065, -1065, -1065, -1065, 677, 677, 677, 677,
67-
677, 677, 677, 677, -1275, -1275, -1275, -1275, -1275, -1275, -1275, -1275,
68-
/* For intt Len=2, offset IZETA_NTT_OFFSET64 */
69-
-1103, -1103, -1103, -1103, 430, 430, 430, 430, 555, 555, 555, 555, 843,
70-
843, 843, 843, -1251, -1251, -1251, -1251, 871, 871, 871, 871, 1550, 1550,
71-
1550, 1550, 105, 105, 105, 105, 422, 422, 422, 422, 587, 587, 587, 587, 177,
72-
177, 177, 177, -235, -235, -235, -235, -291, -291, -291, -291, -460, -460,
73-
-460, -460, 1574, 1574, 1574, 1574, 1653, 1653, 1653, 1653, -246, -246,
74-
-246, -246, 778, 778, 778, 778, 1159, 1159, 1159, 1159, -147, -147, -147,
75-
-147, -777, -777, -777, -777, 1483, 1483, 1483, 1483, -602, -602, -602,
76-
-602, 1119, 1119, 1119, 1119, -1590, -1590, -1590, -1590, 644, 644, 644,
77-
644, -872, -872, -872, -872, 349, 349, 349, 349, 418, 418, 418, 418, 329,
78-
329, 329, 329, -156, -156, -156, -156, -75, -75, -75, -75, 817, 817, 817,
79-
817, 1097, 1097, 1097, 1097, 603, 603, 603, 603, 610, 610, 610, 610, 1322,
80-
1322, 1322, 1322, -1285, -1285, -1285, -1285, -1465, -1465, -1465, -1465,
81-
384, 384, 384, 384, -1215, -1215, -1215, -1215, -136, -136, -136, -136,
82-
1218, 1218, 1218, 1218, -1335, -1335, -1335, -1335, -874, -874, -874, -874,
83-
220, 220, 220, 220, -1187, -1187, -1187, -1187, -1659, -1659, -1659, -1659,
84-
-1185, -1185, -1185, -1185, -1530, -1530, -1530, -1530, -1278, -1278, -1278,
85-
-1278, 794, 794, 794, 794, -1510, -1510, -1510, -1510, -854, -854, -854,
86-
-854, -870, -870, -870, -870, 478, 478, 478, 478, -108, -108, -108, -108,
87-
-308, -308, -308, -308, 996, 996, 996, 996, 991, 991, 991, 991, 958, 958,
88-
958, 958, -1460, -1460, -1460, -1460, 1522, 1522, 1522, 1522, 1628, 1628,
89-
1628, 1628,
90-
/* For intt Len=2, offset IZETA_NTT_OFFSET127 */
91-
1628, 1628, 1628, 1628, 1522, 1522, 1522, 1522, -1460, -1460, -1460, -1460,
92-
958, 958, 958, 958, 991, 991, 991, 991, 996, 996, 996, 996, -308, -308,
93-
-308, -308, -108, -108, -108, -108, 478, 478, 478, 478, -870, -870, -870,
94-
-870, -854, -854, -854, -854, -1510, -1510, -1510, -1510, 794, 794, 794,
95-
794, -1278, -1278, -1278, -1278, -1530, -1530, -1530, -1530, -1185, -1185,
96-
-1185, -1185, -1659, -1659, -1659, -1659, -1187, -1187, -1187, -1187, 220,
97-
220, 220, 220, -874, -874, -874, -874, -1335, -1335, -1335, -1335, 1218,
98-
1218, 1218, 1218, -136, -136, -136, -136, -1215, -1215, -1215, -1215, 384,
99-
384, 384, 384, -1465, -1465, -1465, -1465, -1285, -1285, -1285, -1285, 1322,
100-
1322, 1322, 1322, 610, 610, 610, 610, 603, 603, 603, 603, 1097, 1097, 1097,
101-
1097, 817, 817, 817, 817, -75, -75, -75, -75, -156, -156, -156, -156, 329,
102-
329, 329, 329, 418, 418, 418, 418, 349, 349, 349, 349, -872, -872, -872,
103-
-872, 644, 644, 644, 644, -1590, -1590, -1590, -1590, 1119, 1119, 1119,
104-
1119, -602, -602, -602, -602, 1483, 1483, 1483, 1483, -777, -777, -777,
105-
-777, -147, -147, -147, -147, 1159, 1159, 1159, 1159, 778, 778, 778, 778,
106-
-246, -246, -246, -246, 1653, 1653, 1653, 1653, 1574, 1574, 1574, 1574,
107-
-460, -460, -460, -460, -291, -291, -291, -291, -235, -235, -235, -235, 177,
108-
177, 177, 177, 587, 587, 587, 587, 422, 422, 422, 422, 105, 105, 105, 105,
109-
1550, 1550, 1550, 1550, 871, 871, 871, 871, -1251, -1251, -1251, -1251, 843,
110-
843, 843, 843, 555, 555, 555, 555, 430, 430, 430, 430, -1103, -1103, -1103,
111-
-1103,
112-
/* For intt Len=4 and others, offset IZETA_NTT_OFFSET63 */
113-
-1275, -1275, -1275, -1275, -1275, -1275, -1275, -1275, 677, 677, 677, 677,
114-
677, 677, 677, 677, -1065, -1065, -1065, -1065, -1065, -1065, -1065, -1065,
115-
448, 448, 448, 448, 448, 448, 448, 448, -725, -725, -725, -725, -725, -725,
116-
-725, -725, -1508, -1508, -1508, -1508, -1508, -1508, -1508, -1508, 961,
117-
961, 961, 961, 961, 961, 961, 961, -398, -398, -398, -398, -398, -398, -398,
118-
-398, -951, -951, -951, -951, -951, -951, -951, -951, -247, -247, -247,
119-
-247, -247, -247, -247, -247, -1421, -1421, -1421, -1421, -1421, -1421,
120-
-1421, -1421, 107, 107, 107, 107, 107, 107, 107, 107, 830, 830, 830, 830,
121-
830, 830, 830, 830, -271, -271, -271, -271, -271, -271, -271, -271, -90,
122-
-90, -90, -90, -90, -90, -90, -90, -853, -853, -853, -853, -853, -853, -853,
123-
-853, 1469, 1469, 1469, 1469, 1469, 1469, 1469, 1469, 126, 126, 126, 126,
124-
126, 126, 126, 126, -1162, -1162, -1162, -1162, -1162, -1162, -1162, -1162,
125-
-1618, -1618, -1618, -1618, -1618, -1618, -1618, -1618, -666, -666, -666,
126-
-666, -666, -666, -666, -666, -320, -320, -320, -320, -320, -320, -320,
127-
-320, -8, -8, -8, -8, -8, -8, -8, -8, 516, 516, 516, 516, 516, 516, 516,
128-
516, -1544, -1544, -1544, -1544, -1544, -1544, -1544, -1544, -282, -282,
129-
-282, -282, -282, -282, -282, -282, 1491, 1491, 1491, 1491, 1491, 1491,
130-
1491, 1491, -1293, -1293, -1293, -1293, -1293, -1293, -1293, -1293, 1015,
131-
1015, 1015, 1015, 1015, 1015, 1015, 1015, -552, -552, -552, -552, -552,
132-
-552, -552, -552, 652, 652, 652, 652, 652, 652, 652, 652, 1223, 1223, 1223,
133-
1223, 1223, 1223, 1223, 1223, -1571, -1571, -1571, -1571, -1571, -1571,
134-
-1571, -1571, -205, -205, -205, -205, -205, -205, -205, -205, 411, 411, 411,
135-
411, 411, 411, 411, 411, -1542, -1542, -1542, -1542, -1542, -1542, -1542,
136-
-1542, 608, 608, 608, 608, 608, 608, 608, 608, 732, 732, 732, 732, 732, 732,
137-
732, 732, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, -681, -681, -681,
138-
-681, -681, -681, -681, -681, -130, -130, -130, -130, -130, -130, -130,
139-
-130, -1602, -1602, -1602, -1602, -1602, -1602, -1602, -1602, 1458, 1458,
140-
1458, 1458, 1458, 1458, 1458, 1458, -829, -829, -829, -829, -829, -829,
141-
-829, -829, 383, 383, 383, 383, 383, 383, 383, 383, 264, 264, 264, 264, 264,
142-
264, 264, 264, -1325, -1325, -1325, -1325, -1325, -1325, -1325, -1325, 573,
143-
573, 573, 573, 573, 573, 573, 573, 1468, 1468, 1468, 1468, 1468, 1468, 1468,
144-
1468, -1474, -1474, -1474, -1474, -1474, -1474, -1474, -1474, -1202, -1202,
145-
-1202, -1202, -1202, -1202, -1202, -1202, 962, 962, 962, 962, 962, 962, 962,
146-
962, 182, 182, 182, 182, 182, 182, 182, 182, 1577, 1577, 1577, 1577, 1577,
147-
1577, 1577, 1577, 622, 622, 622, 622, 622, 622, 622, 622, -171, -171, -171,
148-
-171, -171, -171, -171, -171, 202, 202, 202, 202, 202, 202, 202, 202, 287,
149-
287, 287, 287, 287, 287, 287, 287, 1422, 1422, 1422, 1422, 1422, 1422, 1422,
150-
1422, 1493, 1493, 1493, 1493, 1493, 1493, 1493, 1493, -1517, -1517, -1517,
151-
-1517, -1517, -1517, -1517, -1517, -359, -359, -359, -359, -359, -359, -359,
152-
-359, -758, -758, -758, -758, -758, -758, -758, -758};
35+
3329,
36+
3329,
37+
3329,
38+
3329,
39+
3329,
40+
3329,
41+
3329,
42+
3329,
43+
/* check-magic: 20159 == round(2^26 / MLKEM_Q) */
44+
20159,
45+
20159,
46+
20159,
47+
20159,
48+
20159,
49+
20159,
50+
20159,
51+
20159,
52+
/* check-magic: 1441 == pow(2,32-7,MLKEM_Q) */
53+
1441,
54+
1441,
55+
1441,
56+
1441,
57+
1441,
58+
1441,
59+
1441,
60+
1441,
61+
/* check-magic: 1353 == pow(2, 32, MLKEM_Q) */
62+
1353,
63+
1353,
64+
1353,
65+
1353,
66+
1353,
67+
1353,
68+
1353,
69+
1353,
70+
/* zetas for NTT */
71+
#include "consts_ntt.inc"
72+
,
73+
/* zetas for invNTT */
74+
#include "consts_intt.inc"
75+
};
15376

154-
#endif /* MLK_ARITH_BACKEND_PPC64LE_DEFAULT && \
155-
!MLK_CONFIG_MULTILEVEL_NO_SHARED */
77+
#endif /* MLK_ARITH_BACKEND_PPC64LE && !MLK_CONFIG_MULTILEVEL_NO_SHARED */

mlkem/src/native/ppc64le/src/consts.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#define MLK_NATIVE_PPC64LE_SRC_CONSTS_H
88
#include "../../../common.h"
99

10+
/* Offsets into the constant table */
11+
/* check-magic: off */
1012
#define NQ_OFFSET 0
1113
#define QINV_OFFSET 16
1214
#define Q_OFFSET 32
@@ -17,6 +19,7 @@
1719
#define ZETA_NTT_OFFSET64 1104
1820
#define IZETA_NTT_OFFSET127 1616
1921
#define IZETA_NTT_OFFSET63 2128
22+
/* check-magic: on */
2023

2124
#ifndef __ASSEMBLER__
2225
#define mlk_ppc_qdata MLK_NAMESPACE(ppc_qdata)

0 commit comments

Comments
 (0)