-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.s
55 lines (41 loc) · 1.14 KB
/
add.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# .p2align 4,,15
# .macro add_block src, dst, i
# mov r10, qword ptr [\src + \i]
# mov r9, qword ptr [\src + \i+8]
# adcx r10, qword ptr [\dst + \i]
# adcx r9, qword ptr [\dst + \i+8]
# mov qword ptr [\dst + \i], r10
# mov qword ptr [\dst + \i+8], r9
# .endm
# .macro add_bytes_macro src=rsi, dst=rdi
# clc
# add_block \src, \dst, 0
# add_block \src, \dst, 16
# add_block \src, \dst, 32
# add_block \src, \dst, 48
# .endm
.macro add_bytes_macro src=rsi, dst=rdi
xor eax, eax
xor rcx, rcx
_add\@:
add al, -1
mov r9, qword ptr [\src + rcx + 0 ]
adc qword ptr [\dst + rcx + 0 ], r9
mov r9, qword ptr [\src + rcx+ 8 ]
adc qword ptr [\dst + rcx + 8], r9
setb al
add rcx, 16
cmp rcx, 64
jne _add\@
.endm
.macro add_bytes512_macro val=r10, dst=rdi
add qword ptr [\dst + 0], \val
xor \val, \val
adc qword ptr [\dst + 8], \val
adc qword ptr [\dst + 16], \val
adc qword ptr [\dst + 24], \val
adc qword ptr [\dst + 32], \val
adc qword ptr [\dst + 40], \val
adc qword ptr [\dst + 48], \val
adc qword ptr [\dst + 56], \val
.endm