diff options
author | lloyd <[email protected]> | 2007-03-12 02:38:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-03-12 02:38:26 +0000 |
commit | bfda1bc3734183d2023f00a8ef4841c4ed31dc8c (patch) | |
tree | 9fae39096bbf1929816079bea072f850e35069d5 /modules/alg_amd64/asm_macr.h | |
parent | 615e45ccc278ee8109c2badb8f666abc720f0dca (diff) |
Check in an initial assembler implementation of SHA-1 for x86-64 systems.
It is not amazingly optimized, about 5% faster than what GCC 4.1.1 does
on my Core2 with the normal C++ code, but it's a start.
Diffstat (limited to 'modules/alg_amd64/asm_macr.h')
-rw-r--r-- | modules/alg_amd64/asm_macr.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/alg_amd64/asm_macr.h b/modules/alg_amd64/asm_macr.h index 0b931daaa..6b9aaba75 100644 --- a/modules/alg_amd64/asm_macr.h +++ b/modules/alg_amd64/asm_macr.h @@ -96,6 +96,7 @@ func_name: * Memory Access Operations * *************************************************/ #define ARRAY8(REG, NUM) 8*(NUM)(REG) +#define ARRAY4(REG, NUM) 4*(NUM)(REG) #define ASSIGN(TO, FROM) mov FROM, TO @@ -104,19 +105,23 @@ func_name: *************************************************/ #define IMM(VAL) $VAL -#define ADD(TO, FROM) addq FROM, TO -#define ADD_LAST_CARRY(REG) adcq IMM(0), REG +#define ADD(TO, FROM) add FROM, TO +#define ADD_LAST_CARRY(REG) adc IMM(0), REG #define ADD_IMM(TO, NUM) ADD(TO, IMM(NUM)) -#define ADD_W_CARRY(TO1, TO2, FROM) addq FROM, TO1; adcq IMM(0), TO2; +#define ADD_W_CARRY(TO1, TO2, FROM) add FROM, TO1; adc IMM(0), TO2; #define SUB_IMM(TO, NUM) sub IMM(NUM), TO -#define MUL(REG) mulq REG +#define MUL(REG) mul REG -#define XOR(TO, FROM) xorq FROM, TO -#define AND(TO, FROM) andq FROM, TO -#define OR(TO, FROM) orq FROM, TO -#define NOT(REG) notq REG +#define XOR(TO, FROM) xor FROM, TO +#define AND(TO, FROM) and FROM, TO +#define OR(TO, FROM) or FROM, TO +#define NOT(REG) not REG #define ZEROIZE(REG) XOR(REG, REG) #define RETURN_VALUE_IS(V) ASSIGN(%rax, V) +#define ROTL_IMM(REG, NUM) rol IMM(NUM), REG +#define ROTR_IMM(REG, NUM) ror IMM(NUM), REG +#define ADD3_IMM(TO, FROM, NUM) lea NUM(TO,FROM,1), TO + #endif |