]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
arm/v6: AES microptimization.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 16 May 2013 09:09:30 +0000 (11:09 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 16 May 2013 09:09:30 +0000 (11:09 +0200)
ChangeLog
arm/aes.m4
arm/v6/aes-decrypt-internal.asm
arm/v6/aes-encrypt-internal.asm

index 12629d5b26c807665de5bde731b2af513837d5fd..be4a73a6a38661a6e66222a40c4db46e3d5fd0d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * arm/aes.m4 (AES_ENCRYPT_ROUND, AES_DECRYPT): Moved macros to the
        files using them.
+       (AES_FINAL_ROUND): Eliminated one uxtb instruction.
 
        * arm/v6/aes-encrypt-internal.asm: Use ALIGN macro. Use 16-byte
        alignment for loops.
index 408e35e4fa50636dbecf3831d0b21ef598ec6578..d1fdc761f773cf7f6807d3de9992017c6eebe947 100644 (file)
@@ -33,9 +33,8 @@ define(<AES_FINAL_ROUND>, <
        uxtb    T0, $3, ror #16
        ldrb    T0, [TABLE, T0]
        eor     $6, $6, T0, lsl #16
-       uxtb    T0, $4, ror #24
-       ldrb    T0, [TABLE, T0]
+       ldrb    T0, [TABLE, $4, lsr #24]
        eor     $6, $6, T0, lsl #24
        ldr     T0, [$5], #+4
-       eor     $6, T0
+       eor     $6, $6, T0
 >)
index 0c8cfc5ed7dc65756075ed8b8d61a42666d67f25..e9b6e570d35ddf2b96569ef4dd048de329850a3d 100644 (file)
@@ -19,10 +19,6 @@ C MA 02111-1301, USA.
 
 include_src(<arm/aes.m4>)
 
-C      Benchmarked at at 785, 914, 1051 cycles/block on cortex A9,
-C      for 128, 192 and 256 bit key sizes. Unclear why it is slower
-C      than _aes_encrypt.
-
 define(<CTX>, <r0>)
 define(<TABLE>, <r1>)
 define(<LENGTH>, <r2>)
@@ -119,7 +115,7 @@ PROLOGUE(_nettle_aes_decrypt)
 
        push    {r4,r5,r6,r7,r8,r10,r11,lr}
        nop     C For some mysterious reason, taking out this nop
-               C slows this function down on Cortex-A9.
+               C slows this function down by 10(!) % on Cortex-A9.
        ALIGN(16)
 .Lblock_loop:
        mov     KEY, CTX
index 69556a35aea63570fc328c49791cf94ea80ed4aa..6887b89981e9dad266bb570d64e7d856f610629d 100644 (file)
@@ -19,7 +19,7 @@ C MA 02111-1301, USA.
 
 include_src(<arm/aes.m4>)
 
-C      Benchmarked at at 693, 824, 950 cycles/block on cortex A9,
+C      Benchmarked at at 680, 818, 929 cycles/block on cortex A9,
 C      for 128, 192 and 256 bit key sizes.
 
 C      Possible improvements: More efficient load and store with