From bd5de696d17c19180d2351c288836d328160e5e4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 25 Mar 2023 10:03:11 +0000 Subject: [PATCH] in xchacha20 svp64 assembler remove r22 from setvl and use (new, modified) setvl options. see simplev.mdwn --- crypto/chacha20/src/xchacha_encrypt_bytes_svp64.s | 3 +-- crypto/chacha20/src/xchacha_hchacha20_svp64.s | 3 +-- crypto/chacha20/src/xchacha_svp64_macros.s | 11 ++++------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/crypto/chacha20/src/xchacha_encrypt_bytes_svp64.s b/crypto/chacha20/src/xchacha_encrypt_bytes_svp64.s index 60045f31..6e9a33ea 100644 --- a/crypto/chacha20/src/xchacha_encrypt_bytes_svp64.s +++ b/crypto/chacha20/src/xchacha_encrypt_bytes_svp64.s @@ -16,7 +16,6 @@ .set SHAPE1, 12 .set SHAPE2, 16 .set SHIFTS, 20 - .set VL, 22 .set j, 24 .set m, 32 .set x, 40 @@ -58,7 +57,7 @@ xchacha_encrypt_bytes_svp64_real: # establish CTR for outer round count li ctr, 10 # Call QuarterRound macro for CTR loops on x[] - quarterround x, ctr, VL, SHAPE0, SHAPE1, SHAPE2, SHIFTS + quarterround x, ctr, SHAPE0, SHAPE1, SHAPE2, SHIFTS # Add j[] to x[], 16 x 32-bit elements setvl 0,0,16,0,1,1 diff --git a/crypto/chacha20/src/xchacha_hchacha20_svp64.s b/crypto/chacha20/src/xchacha_hchacha20_svp64.s index 86866cc2..af3e825b 100644 --- a/crypto/chacha20/src/xchacha_hchacha20_svp64.s +++ b/crypto/chacha20/src/xchacha_hchacha20_svp64.s @@ -15,7 +15,6 @@ .set SHAPE1, 12 .set SHAPE2, 16 .set SHIFTS, 20 - .set VL, 22 .globl xchacha_hchacha20_svp64_real .type xchacha_hchacha20_svp64_real, @function @@ -37,7 +36,7 @@ xchacha_hchacha20_svp64_real: # establish CTR for outer round count and call quarterround macro li ctr, 10 - quarterround x, ctr, VL, SHAPE0, SHAPE1, SHAPE2, SHIFTS + quarterround x, ctr, SHAPE0, SHAPE1, SHAPE2, SHIFTS # store x0-x3 directly to *out_ptr setvl 0,0,2,0,1,1 # Set VL to 4 elements diff --git a/crypto/chacha20/src/xchacha_svp64_macros.s b/crypto/chacha20/src/xchacha_svp64_macros.s index a089387a..677fd5f3 100644 --- a/crypto/chacha20/src/xchacha_svp64_macros.s +++ b/crypto/chacha20/src/xchacha_svp64_macros.s @@ -53,14 +53,11 @@ .endm # This macro uses registers 8-21 -.macro quarterround _x, _ctr, _VL, _SHAPE0, _SHAPE1, _SHAPE2, _SHIFTS +.macro quarterround _x, _ctr, _SHAPE0, _SHAPE1, _SHAPE2, _SHIFTS mtctr \_ctr # Set up counter - # set up VL=32 vertical-first, and SVSHAPEs 0-2 - # set VL/MAXVL first - setvl 0, 0, 32, 0, 1, 1 # MAXVL=VL=32 - # set r22 from VL, set vertical-first - setvl \_VL, 0, 32, 1, 0, 1 # vertical-first mode + # set up MAXVL=VL=32 and vertical-first, then SVSHAPEs 0-2 + setvl 0, 0, 32, 1, 1, 1 # MAXVL=VL=32, VF=1 # SHAPE0, used by sv.add starts at GPR #8 svindex \_SHAPE0/2, 0, 1, 3, 0, 1, 0 # SVSHAPE0, a # SHAPE1, used by sv.xor starts at GPR #12 @@ -73,7 +70,7 @@ .outer: # outer loop begins here (standard CTR loop) - setvl \_VL, \_VL, 32, 1, 1, 0 # vertical-first, set VL from r22 + setvl 0, 0, 32, 1, 1, 1 # MAXVL=VL=32, VF=1 # inner loop begins here. add-xor-rotl32 with remap, step, branch .inner: svremap 31, 1, 0, 0, 0, 0, 0 # RA=1, RB=0, RT=0 (0b01011) -- 2.30.2