internal/sm2ec: s390x, try to use VLM/VSTM #235

This commit is contained in:
Sun Yimin 2024-08-29 08:33:35 +08:00 committed by GitHub
parent a32ca8fa14
commit f0b36b70ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,20 +55,20 @@ TEXT ·p256LittleToBig(SB), NOSPLIT, $0
// func p256BigToLittle(res *p256Element, in *[32]byte) // func p256BigToLittle(res *p256Element, in *[32]byte)
#define res_ptr R1 #define res_ptr R1
#define in_ptr R2 #define in_ptr R2
#define T1L V2 #define T1L V3
#define T1H V3 #define T1H V2
#define T1L2 V1
TEXT ·p256BigToLittle(SB), NOSPLIT, $0 TEXT ·p256BigToLittle(SB), NOSPLIT, $0
MOVD res+0(FP), res_ptr MOVD res+0(FP), res_ptr
MOVD in+8(FP), in_ptr MOVD in+8(FP), in_ptr
VL 0(in_ptr), T1H VLM (in_ptr), T1H, T1L
VL 16(in_ptr), T1L
VPDI $0x4, T1L, T1L, T1L VPDI $0x4, T1L, T1L, T1L2
VPDI $0x4, T1H, T1H, T1H VPDI $0x4, T1H, T1H, T1H
VSTM T1L, T1H, (res_ptr) VSTM T1L2, T1H, (res_ptr)
RET RET
@ -76,6 +76,7 @@ TEXT ·p256BigToLittle(SB), NOSPLIT, $0
#undef in_ptr #undef in_ptr
#undef T1L #undef T1L
#undef T1H #undef T1H
#undef T1L2
// --------------------------------------- // ---------------------------------------
// iff cond == 1 val <- -val // iff cond == 1 val <- -val
@ -100,9 +101,8 @@ TEXT ·p256NegCond(SB), NOSPLIT, $0
MOVD $p256mul<>+0x00(SB), CPOOL MOVD $p256mul<>+0x00(SB), CPOOL
VLM (CPOOL), PH, PL VLM (CPOOL), PH, PL
VL 16(P1ptr), Y1H VLM (P1ptr), Y1L, Y1H
VPDI $0x4, Y1H, Y1H, Y1H VPDI $0x4, Y1H, Y1H, Y1H
VL 0(P1ptr), Y1L
VPDI $0x4, Y1L, Y1L, Y1L VPDI $0x4, Y1L, Y1L, Y1L
VLREPG cond+8(FP), SEL1 VLREPG cond+8(FP), SEL1
@ -117,9 +117,9 @@ TEXT ·p256NegCond(SB), NOSPLIT, $0
VSEL Y1H, T1H, SEL1, Y1H VSEL Y1H, T1H, SEL1, Y1H
VPDI $0x4, Y1H, Y1H, Y1H VPDI $0x4, Y1H, Y1H, Y1H
VST Y1H, 16(P1ptr)
VPDI $0x4, Y1L, Y1L, Y1L VPDI $0x4, Y1L, Y1L, Y1L
VST Y1L, 0(P1ptr) VSTM Y1L, Y1H, (P1ptr)
RET RET
#undef P1ptr #undef P1ptr