Skip to content

Commit 5933458

Browse files
authored
Merge pull request #1057 from pq-code-package/compiler_tests
CI: Run compiler tests with -O0, -Os, and -O3
2 parents 82c8738 + 406da5d commit 5933458

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ jobs:
154154
cflags: "-DMLKEM_DEBUG -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -DMLK_FORCE_AARCH64 -DMLK_CONFIG_FIPS202_BACKEND_FILE=\\\\\\\"fips202/native/aarch64/${{ matrix.backend }}.h\\\\\\\""
155155
check_namespace: 'false'
156156
compiler_tests:
157-
name: Compiler tests (${{ matrix.compiler.name }}, ${{ matrix.target.name }})
157+
name: Compiler tests (${{ matrix.compiler.name }}, ${{ matrix.target.name }}, ${{ matrix.cflags }})
158158
strategy:
159159
fail-fast: false
160160
matrix:
161+
cflags: [ "-O0", "-Os", "-O3" ]
161162
target:
162163
- runner: pqcp-arm64
163164
name: 'aarch64'
@@ -285,6 +286,7 @@ jobs:
285286
examples: ${{ matrix.compiler.examples }}
286287
opt: ${{ matrix.compiler.opt }}
287288
nix-shell: ${{ matrix.compiler.shell }}
289+
cflags: "${{ matrix.cflags }}"
288290
- name: native build+functest (C90)
289291
if: ${{ matrix.compiler.darwin || matrix.target.runner != 'macos-latest' }}
290292
uses: ./.github/actions/multi-functest
@@ -297,7 +299,7 @@ jobs:
297299
examples: ${{ matrix.compiler.examples }}
298300
opt: ${{ matrix.compiler.opt }}
299301
nix-shell: ${{ matrix.compiler.shell }}
300-
cflags: "-std=c90"
302+
cflags: "-std=c90 ${{ matrix.cflags }}"
301303
- name: native build+functest (C99)
302304
if: ${{ matrix.compiler.darwin || matrix.target.runner != 'macos-latest' }}
303305
uses: ./.github/actions/multi-functest
@@ -310,7 +312,7 @@ jobs:
310312
examples: ${{ matrix.compiler.examples }}
311313
opt: ${{ matrix.compiler.opt }}
312314
nix-shell: ${{ matrix.compiler.shell }}
313-
cflags: "-std=c99"
315+
cflags: "-std=c99 ${{ matrix.cflags }}"
314316
- name: native build+functest (C11)
315317
if: ${{ matrix.compiler.darwin || matrix.target.runner != 'macos-latest' }}
316318
uses: ./.github/actions/multi-functest
@@ -323,7 +325,7 @@ jobs:
323325
examples: ${{ matrix.compiler.examples }}
324326
opt: ${{ matrix.compiler.opt }}
325327
nix-shell: ${{ matrix.compiler.shell }}
326-
cflags: "-std=c11"
328+
cflags: "-std=c11 ${{ matrix.cflags }}"
327329
- name: native build+functest (C17)
328330
if: ${{ (matrix.compiler.darwin || matrix.target.runner != 'macos-latest') &&
329331
matrix.compiler.c17 }}
@@ -337,7 +339,7 @@ jobs:
337339
examples: ${{ matrix.compiler.examples }}
338340
opt: ${{ matrix.compiler.opt }}
339341
nix-shell: ${{ matrix.compiler.shell }}
340-
cflags: "-std=c17"
342+
cflags: "-std=c17 ${{ matrix.cflags }}"
341343
- name: native build+functest (C23)
342344
if: ${{ (matrix.compiler.darwin || matrix.target.runner != 'macos-latest') &&
343345
matrix.compiler.c23 }}
@@ -351,7 +353,7 @@ jobs:
351353
examples: ${{ matrix.compiler.examples }}
352354
opt: ${{ matrix.compiler.opt }}
353355
nix-shell: ${{ matrix.compiler.shell }}
354-
cflags: "-std=c23"
356+
cflags: "-std=c23 ${{ matrix.cflags }}"
355357
config_variations:
356358
name: Non-standard configurations
357359
strategy:

dev/aarch64_clean/meta.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,32 @@ static MLK_INLINE void mlk_poly_mulcache_compute_native(
5151
mlk_aarch64_zetas_mulcache_twisted_native);
5252
}
5353

54+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
5455
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
5556
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
5657
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
5758
{
5859
mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(r, a, b, b_cache);
5960
}
61+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
6062

63+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
6164
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
6265
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
6366
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
6467
{
6568
mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(r, a, b, b_cache);
6669
}
70+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
6771

72+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
6873
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
6974
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
7075
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
7176
{
7277
mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(r, a, b, b_cache);
7378
}
79+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
7480

7581
static MLK_INLINE void mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
7682
const int16_t a[MLKEM_N])

dev/aarch64_opt/meta.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,32 @@ static MLK_INLINE void mlk_poly_mulcache_compute_native(
5353
mlk_aarch64_zetas_mulcache_twisted_native);
5454
}
5555

56+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
5657
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
5758
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
5859
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
5960
{
6061
mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(r, a, b, b_cache);
6162
}
63+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
6264

65+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
6366
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
6467
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
6568
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
6669
{
6770
mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(r, a, b, b_cache);
6871
}
72+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
6973

74+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
7075
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
7176
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
7277
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
7378
{
7479
mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(r, a, b, b_cache);
7580
}
81+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
7682

7783
static MLK_INLINE void mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
7884
const int16_t a[MLKEM_N])

mlkem/native/aarch64/meta.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,32 @@ static MLK_INLINE void mlk_poly_mulcache_compute_native(
5353
mlk_aarch64_zetas_mulcache_twisted_native);
5454
}
5555

56+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
5657
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
5758
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
5859
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
5960
{
6061
mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(r, a, b, b_cache);
6162
}
63+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
6264

65+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
6366
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
6467
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
6568
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
6669
{
6770
mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(r, a, b, b_cache);
6871
}
72+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
6973

74+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
7075
static MLK_INLINE void mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
7176
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
7277
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
7378
{
7479
mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(r, a, b, b_cache);
7580
}
81+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
7682

7783
static MLK_INLINE void mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
7884
const int16_t a[MLKEM_N])

0 commit comments

Comments
 (0)