From c71abd738862def986291ee6288f122ff8924c46 Mon Sep 17 00:00:00 2001 From: riastradh Date: Tue, 8 Sep 2020 23:58:09 +0000 Subject: [PATCH] aesarmv8: Reallocate registers to shave off unnecessary MOV. --- sys/crypto/aes/arch/arm/aes_armv8_64.S | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/crypto/aes/arch/arm/aes_armv8_64.S b/sys/crypto/aes/arch/arm/aes_armv8_64.S index 4830fbea9e16..faf3640795d7 100644 --- a/sys/crypto/aes/arch/arm/aes_armv8_64.S +++ b/sys/crypto/aes/arch/arm/aes_armv8_64.S @@ -1,4 +1,4 @@ -/* $NetBSD: aes_armv8_64.S,v 1.14 2020/09/08 23:57:43 riastradh Exp $ */ +/* $NetBSD: aes_armv8_64.S,v 1.15 2020/09/08 23:58:09 riastradh Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ #include -RCSID("$NetBSD: aes_armv8_64.S,v 1.14 2020/09/08 23:57:43 riastradh Exp $") +RCSID("$NetBSD: aes_armv8_64.S,v 1.15 2020/09/08 23:58:09 riastradh Exp $") .arch_extension aes @@ -917,13 +917,12 @@ END(aesarmv8_cbcmac_update1) 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 @@ ENTRY(aesarmv8_ccm_enc1) 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)