-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmp_cmp_n.S
More file actions
64 lines (54 loc) · 894 Bytes
/
mp_cmp_n.S
File metadata and controls
64 lines (54 loc) · 894 Bytes
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
56
57
58
59
60
61
62
63
64
/*
* mp_cmp_n.S
* Copyright (C) 2003-2010 Farooq Mela. All rights reserved.
*
* int mp_cmp_n(const mp_digit *u, const mp_digit *v, mp_len len);
*
* Parameters:
* esp+4 u
* esp+8 v
* esp+12 len
*
* $Id$
*/
#include "mp_config.h"
#ifdef MP_CMP_N_ASM
#define STACK 0x08
#define U_LOC (STACK+0x04)(%esp)
#define V_LOC (STACK+0x08)(%esp)
#define L_LOC (STACK+0x0c)(%esp)
.text
.globl MP_ASM_NAME(mp_cmp_n)
#ifndef __APPLE__
.type MP_ASM_NAME(mp_cmp_n),@function
#endif
.p2align 3
MP_ASM_NAME(mp_cmp_n):
pushl %esi
pushl %edi
xorl %eax,%eax
movl L_LOC,%ecx
orl %ecx,%ecx
jz .Leq
movl U_LOC,%esi
movl V_LOC,%edi
.p2align 3
.Loop:
decl %ecx
movl (%esi,%ecx,4),%edx
cmpl (%edi,%ecx,4),%edx
ja .Labove
jb .Lbelow
orl %ecx,%ecx
jz .Leq
jmp .Loop
.Labove:
movl $+1,%eax
jmp .Leq
.Lbelow:
movl $-1,%eax
.Leq:
popl %edi
popl %esi
ret
#endif /* MP_CMP_N_ASM */