Skip to content

Commit 161b478

Browse files
mjosaarinenmkannwischer
authored andcommitted
added intt initial reductions due to unit test which assumes that inputs to INTT are unconstrained. also removed one of the half-way-layer reductions.
Signed-off-by: Markku-Juhani O. Saarinen <mjos@iki.fi>
1 parent 58dd242 commit 161b478

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mlkem/src/native/riscv64/src/rv64v_poly.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ static vint16m2_t mlk_rv64v_intt2(vint16m2_t vp, vint16m1_t cz)
386386
vp = __riscv_vrgatherei16_vv_i16m2(vp, v2p0, vl2);
387387
t0 = __riscv_vget_v_i16m2_i16m1(vp, 0);
388388
t1 = __riscv_vget_v_i16m2_i16m1(vp, 1);
389+
390+
/* initial reduction due to lack of input assumptions on INTT */
391+
t0 = fq_mul_vx(t0, MLK_RVV_MONT_R1, vl);
392+
t1 = fq_mul_vx(t1, MLK_RVV_MONT_R1, vl);
389393
c0 = __riscv_vrgather_vv_i16m1(cz, cs2, vl);
390394
MLK_RVV_BFLY_RV(t0, t1, vt, c0, vl);
391395

@@ -411,9 +415,8 @@ static vint16m2_t mlk_rv64v_intt2(vint16m2_t vp, vint16m1_t cz)
411415
t0 = __riscv_vget_v_i16m2_i16m1(vp, 0);
412416
t1 = __riscv_vget_v_i16m2_i16m1(vp, 1);
413417

414-
/* normalize */
418+
/* normalize first element */
415419
t0 = fq_mulq_vx(t0, MLK_RVV_MONT_R1, vl);
416-
t1 = fq_mulq_vx(t1, MLK_RVV_MONT_R1, vl);
417420

418421
vp = __riscv_vcreate_v_i16m1_i16m2(t0, t1);
419422

0 commit comments

Comments
 (0)