diff options
author | lloyd <[email protected]> | 2006-08-15 17:06:57 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-15 17:06:57 +0000 |
commit | d0a5ecdb4f7b1ddbefdc6a46525c276b9203abfe (patch) | |
tree | 1fb436168fe3a26c96c9f1c840269e39bca07463 | |
parent | 3ba05971bb1ac7b689a636d78680f3abc1cbf14d (diff) |
Add a distinct loop ending for loop-until-equals-immediate; other loops
ending conditions will be needed later.
-rw-r--r-- | modules/alg_ia32/asm_macr.h | 10 | ||||
-rw-r--r-- | modules/alg_ia32/md4core.S | 2 | ||||
-rw-r--r-- | modules/alg_ia32/md5core.S | 2 | ||||
-rw-r--r-- | modules/alg_ia32/serp_asm.S | 2 | ||||
-rw-r--r-- | modules/alg_ia32/sha1core.S | 4 |
5 files changed, 13 insertions, 7 deletions
diff --git a/modules/alg_ia32/asm_macr.h b/modules/alg_ia32/asm_macr.h index dec14b738..faa55aa96 100644 --- a/modules/alg_ia32/asm_macr.h +++ b/modules/alg_ia32/asm_macr.h @@ -33,11 +33,15 @@ func_name: * Loop Control * *************************************************/ #define START_LOOP(LABEL) \ - ALIGN; \ + ALIGN; \ LABEL##_LOOP: +#define LOOP_UNTIL_EQ(REG, NUM, LABEL) \ + cmpl IMM(NUM), REG; \ + jne LABEL##_LOOP + #define LOOP_UNTIL(REG, NUM, LABEL) \ - cmpl NUM, REG; \ + cmpl NUM, REG; \ jne LABEL##_LOOP /************************************************* @@ -89,6 +93,8 @@ func_name: #define ADD2_IMM(TO, FROM, NUM) leal NUM(FROM), TO #define ADD3_IMM(TO, FROM, NUM) leal NUM(TO,FROM,1), TO +#define CLEAR_CARRY() clc + #define SHL_IMM(REG, SHIFT) shll IMM(SHIFT), REG #define SHR_IMM(REG, SHIFT) shrl IMM(SHIFT), REG #define SHL2_3(TO, FROM) leal 0(,FROM,8), TO diff --git a/modules/alg_ia32/md4core.S b/modules/alg_ia32/md4core.S index f6289a757..ebb208c4a 100644 --- a/modules/alg_ia32/md4core.S +++ b/modules/alg_ia32/md4core.S @@ -31,7 +31,7 @@ START_LOOP(.LOAD_INPUT) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-3), EBX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-2), ECX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-1), EDX) -LOOP_UNTIL(ESI, IMM(16), .LOAD_INPUT) +LOOP_UNTIL_EQ(ESI, 16, .LOAD_INPUT) ASSIGN(EBP, ARG(1)) ASSIGN(EAX, ARRAY4(EBP, 0)) diff --git a/modules/alg_ia32/md5core.S b/modules/alg_ia32/md5core.S index 857c3848f..1d82e7c81 100644 --- a/modules/alg_ia32/md5core.S +++ b/modules/alg_ia32/md5core.S @@ -31,7 +31,7 @@ START_LOOP(.LOAD_INPUT) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-3), EBX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-2), ECX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-1), EDX) -LOOP_UNTIL(ESI, IMM(16), .LOAD_INPUT) +LOOP_UNTIL_EQ(ESI, 16, .LOAD_INPUT) ASSIGN(EBP, ARG(1)) ASSIGN(EAX, ARRAY4(EBP, 0)) diff --git a/modules/alg_ia32/serp_asm.S b/modules/alg_ia32/serp_asm.S index ddaa99606..718e8cb74 100644 --- a/modules/alg_ia32/serp_asm.S +++ b/modules/alg_ia32/serp_asm.S @@ -609,7 +609,7 @@ START_LOOP(.EXPANSION) ADD_IMM(ESI, 1) ADD_IMM(EDI, 4) -LOOP_UNTIL(ESI, IMM(140), .EXPANSION) +LOOP_UNTIL_EQ(ESI, 140, .EXPANSION) ASSIGN(EDI, ARG(1)) /* round keys */ diff --git a/modules/alg_ia32/sha1core.S b/modules/alg_ia32/sha1core.S index 347d22095..a8c1b2dc9 100644 --- a/modules/alg_ia32/sha1core.S +++ b/modules/alg_ia32/sha1core.S @@ -36,7 +36,7 @@ START_LOOP(.LOAD_INPUT) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-3), EBX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-2), ECX) ASSIGN(ARRAY4_INDIRECT(EDI,ESI,-1), EDX) -LOOP_UNTIL(ESI, IMM(16), .LOAD_INPUT) +LOOP_UNTIL_EQ(ESI, 16, .LOAD_INPUT) ADD2_IMM(EBP, EDI, 64) @@ -75,7 +75,7 @@ START_LOOP(.EXPANSION) ASSIGN(ARRAY4(EBP, 3), EAX) ADD_IMM(EBP, 16) -LOOP_UNTIL(ESI, IMM(80), .EXPANSION) +LOOP_UNTIL_EQ(ESI, 80, .EXPANSION) ASSIGN(EBP, ARG(1)) ASSIGN(EAX, ARRAY4(EBP, 0)) |