|
5 | 5 |
|
6 | 6 | #include "../../../common.h" |
7 | 7 |
|
8 | | -#if defined(MLK_ARITH_BACKEND_PPC64LE_DEFAULT) && \ |
| 8 | +#if defined(MLK_ARITH_BACKEND_PPC64LE) && \ |
9 | 9 | !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) |
10 | 10 |
|
11 | 11 | #include "consts.h" |
12 | 12 |
|
13 | | -MLK_ALIGN const int16_t mlk_ppc_qdata[1568] = { |
| 13 | +MLK_ALIGN const int16_t mlk_ppc_qdata[] = { |
14 | 14 | /* -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, |
16 | 24 | /* 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, |
18 | 34 | /* 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 | +}; |
153 | 76 |
|
154 | | -#endif /* MLK_ARITH_BACKEND_PPC64LE_DEFAULT && \ |
155 | | - !MLK_CONFIG_MULTILEVEL_NO_SHARED */ |
| 77 | +#endif /* MLK_ARITH_BACKEND_PPC64LE && !MLK_CONFIG_MULTILEVEL_NO_SHARED */ |
0 commit comments