Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/crypto/aes/arch/arm aesarmv8: Reallocate registers...



details:   https://anonhg.NetBSD.org/src-all/rev/212d5a60792e
branches:  trunk
changeset: 938481:212d5a60792e
user:      Taylor R Campbell <riastradh%NetBSD.org@localhost>
date:      Tue Sep 08 23:24:57 2020 +0000

description:
aesarmv8: Reallocate registers to shave off unnecessary MOV.

diffstat:

 sys/crypto/aes/arch/arm/aes_armv8_64.S |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 1786af896714 -r 212d5a60792e sys/crypto/aes/arch/arm/aes_armv8_64.S
--- a/sys/crypto/aes/arch/arm/aes_armv8_64.S    Tue Sep 08 23:23:57 2020 +0000
+++ b/sys/crypto/aes/arch/arm/aes_armv8_64.S    Tue Sep 08 23:24:57 2020 +0000
@@ -917,13 +917,12 @@
 ENTRY(aesarmv8_ccm_enc1)
        stp     fp, lr, [sp, #-16]!     /* push stack frame */
        mov     fp, sp
-       ld1     {v0.16b, v1.16b}, [x4]  /* q0 := auth, q2 := ctr (be) */
-       mov     v2.16b, v1.16b
+       ld1     {v0.16b-v1.16b}, [x4]   /* q0 := auth, q1 := ctr (be) */
        adrl    x11, ctr32_inc          /* x11 := &ctr32_inc */
        ld1     {v5.4s}, [x11]          /* q5 := (0,0,0,1) (host-endian) */
        mov     x9, x0                  /* x9 := enckey */
        mov     x10, x3                 /* x10 := nbytes */
-       rev32   v2.16b, v2.16b          /* q2 := ctr (host-endian) */
+       rev32   v2.16b, v1.16b          /* q2 := ctr (host-endian) */
        _ALIGN_TEXT
 1:     ld1     {v3.16b}, [x1], #0x10   /* q3 := plaintext block */
        add     v2.4s, v2.4s, v5.4s     /* increment ctr (32-bit) */
@@ -937,9 +936,8 @@
        subs    x10, x10, #0x10         /* count down bytes */
        st1     {v3.16b}, [x2], #0x10   /* store ciphertext block */
        b.ne    1b                      /* repeat if more blocks */
-       rev32   v2.16b, v2.16b          /* q2 := ctr (big-endian) */
-       mov     v1.16b, v2.16b          /* store updated auth/ctr */
-       st1     {v0.16b-v1.16b}, [x4]
+       rev32   v1.16b, v2.16b          /* q1 := ctr (big-endian) */
+       st1     {v0.16b-v1.16b}, [x4]   /* store updated auth/ctr */
        ldp     fp, lr, [sp], #16       /* pop stack frame */
        ret
 END(aesarmv8_ccm_enc1)



Home | Main Index | Thread Index | Old Index