From ca23f2234d9601e47c3b7bc83144a82af9dbb6f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 15 May 2002 22:41:45 +0200
Subject: [PATCH] (_aes_crypt): Eliminated updates of i from the loop.

Rev: src/nettle/sparc/aes.asm:1.91
---
 sparc/aes.asm | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/sparc/aes.asm b/sparc/aes.asm
index 2a72eaa9..2b69c217 100644
--- a/sparc/aes.asm
+++ b/sparc/aes.asm
@@ -292,7 +292,7 @@ undefine(<i>)
 define(i, round)
 
 	! Comments mark which j in T->sbox[Bj(wtxt[IDXj(i)])]
-	! the instruction is part of
+	! the instruction is part of.
 
 	C Unrolled final loop begins
 	! NOTE: First instruction duplicated in delay slot
@@ -325,7 +325,7 @@ define(i, round)
 	
 	or	t0, t3, t0	! 0, 1, 2, 3
 	xor	t0, t2, t0
-	add	i, 4, i
+	C add	i, 4, i
 	
 	srl	t0, 24, t3
 	srl	t0, 16, t2
@@ -343,7 +343,7 @@ define(i, round)
 	add	wtxt, t1, t1	! 1
 	ldub	[t1+2], t1	! 1
 
-	ld	[wtxt+i], t0	! 0
+	ld	[wtxt+4], t0	! 0
 	! IDX2(j) = j XOR 2
 	lduh	[wtxt+12], t2	! 2
 	and	t0, 255, t0	! 0
@@ -366,7 +366,7 @@ define(i, round)
 	
 	or	t0, t3, t0	! 0, 1, 2, 3
 	xor	t0, t2, t0
-	add	i, 4, i
+	C add	i, 4, i
 	
 	srl	t0, 24, t3
 	srl	t0, 16, t2
@@ -407,7 +407,7 @@ define(i, round)
 	
 	or	t0, t3, t0	! 0, 1, 2, 3
 	xor	t0, t2, t0
-	add	i, 4, i
+	C add	i, 4, i
 	
 	srl	t0, 24, t3
 	srl	t0, 16, t2
@@ -422,11 +422,10 @@ define(i, round)
 	C i = 3
 	ld	[IDX1+12], t1 	! 1
 
-	xor	i, 8, t2
 	add	wtxt, t1, t1	! 1
 	ldub	[t1+2], t1	! 1
 
-	ld	[wtxt+i], t0	! 0
+	ld	[wtxt+12], t0	! 0
 	! IDX2(j) = j XOR 2
 	lduh	[wtxt+4], t2	! 2
 	and	t0, 255, t0	! 0
@@ -449,7 +448,7 @@ define(i, round)
 	
 	or	t0, t3, t0	! 0, 1, 2, 3
 	xor	t0, t2, t0
-	add	i, 4, i
+	C add	i, 4, i
 	
 	srl	t0, 24, t3
 	srl	t0, 16, t2
@@ -461,8 +460,6 @@ define(i, round)
 	stb	t0, [dst]
 	add	dst, 4, dst
 	
-	C ld	[IDX1+i], t1 	! 1
-			
 	C Unrolled final loop ends
 	
 	addcc	length, -16, length
-- 
GitLab