From 0c0b54ec7b2c6d0a27234dde2673ce64f1f2a66f Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Tue, 14 Oct 2025 09:40:48 +0800 Subject: [PATCH] internal/sm2e: loong64 fix sm2P256SqrInternal --- internal/sm2ec/p256_asm_loong64.s | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/sm2ec/p256_asm_loong64.s b/internal/sm2ec/p256_asm_loong64.s index 2ec8d4a..c097f26 100644 --- a/internal/sm2ec/p256_asm_loong64.s +++ b/internal/sm2ec/p256_asm_loong64.s @@ -394,6 +394,7 @@ TEXT sm2P256SqrInternal<>(SB),NOSPLIT,$0 SGTU t1, acc4, t3 ADDV t2, acc4, acc4 SGTU t2, acc4, t4 + // ADC $0, acc5 OR t3, t4, acc5 MULV x1, x3, t0 @@ -402,16 +403,17 @@ TEXT sm2P256SqrInternal<>(SB),NOSPLIT,$0 SGTU t0, acc4, t2 MULHVU x1, x3, t1 // ADC t1, acc5 - ADDV t1, acc5, acc5 // no carry + ADDV t1, t2, t2 // no carry + ADDV t2, acc5, acc5 // no carry // x[3] * x[2] MULV x2, x3, t0 // ADDS t0, acc5 ADDV t0, acc5, acc5 - SGTU t0, acc5, t2 - MULHVU x2, x3, t1 - // ADC t1, acc6 - ADDV t1, t2, acc6 // no carry + SGTU t0, acc5, t1 + MULHVU x2, x3, acc6 + // ADC $0, acc6 + ADDV t1, acc6, acc6 // no carry // *2 // ALSLV is NOT supported in go 1.25