From 75aac0daa9a69bad98a7236ebe47286848c0552d Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 26 Jun 2017 21:11:19 -0500 Subject: [PATCH] Save a couple values on the stack rather than looking them up again. This is cycle-neutral (assuming a page-aligned DP), but it reduces instruction bytes and therefore may give a speedup on accelerators with caches. --- aes.macros | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/aes.macros b/aes.macros index 63d14c7..3df6d67 100644 --- a/aes.macros +++ b/aes.macros @@ -30,40 +30,40 @@ macro MixColumn &i,&A,&B,&C,&D,&state,&out - + + ldy &state+&D + lda Sbox,Y + pha ldx &state+&A - lda Xtime2Sbox,X + eor Xtime2Sbox,X ldy &state+&B eor Xtime3Sbox,Y - ldy &state+&D - eor Sbox,Y ldy &state+&C eor Sbox,Y eor rk+&round*16+&i sta &out+&i - lda Xtime3Sbox,Y + pla + eor Xtime3Sbox,Y eor Sbox,X ldy &state+&B eor Xtime2Sbox,Y - ldy &state+&D - eor Sbox,Y eor rk+&round*16+&i+1 sta &out+&i+1 - lda Xtime3Sbox,Y + lda Sbox,Y + pha + ldy &state+&D + eor Xtime3Sbox,Y eor Sbox,X - ldy &state+&B - eor Sbox,Y ldy &state+&C eor Xtime2Sbox,Y eor rk+&round*16+&i+2 sta &out+&i+2 - lda Sbox,Y - eor Xtime3Sbox,X - ldy &state+&B + pla eor Sbox,Y + eor Xtime3Sbox,X ldy &state+&D eor Xtime2Sbox,Y eor rk+&round*16+&i+3