Ticket #46589: tmp-gcd_1.s
File tmp-gcd_1.s, 1007 bytes (added by larryv (Lawrence Velázquez), 10 years ago) |
---|
Line | |
---|---|
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 | .text |
61 | .globl ___gmpn_gcd_1 |
62 | .align 5 |
63 | ___gmpn_gcd_1: |
64 | mflr r0 |
65 | std r30, -16(r1) |
66 | std r31, -8(r1) |
67 | std r0, 16(r1) |
68 | stdu r1, -128(r1) |
69 | |
70 | ld r7, 0(r3) |
71 | or r0, r5, r7 |
72 | |
73 | neg r6, r0 |
74 | and r6, r6, r0 |
75 | cntlzd r31, r6 |
76 | subfic r31, r31, 63 |
77 | |
78 | neg r6, r5 |
79 | and r6, r6, r5 |
80 | cntlzd r8, r6 |
81 | subfic r8, r8, 63 |
82 | srd r5, r5, r8 |
83 | mr r30, r5 |
84 | |
85 | cmpdi r4, BMOD_1_TO_MOD_1_THRESHOLD |
86 | blt Lbmod |
87 | bl ___gmpn_mod_1 |
88 | b Lreduced |
89 | Lbmod: |
90 | li r6, 0 |
91 | bl ___gmpn_modexact_1c_odd |
92 | Lreduced: |
93 | |
94 | |
95 | neg. r6, r3 |
96 | and r6, r6, r3 |
97 | cntlzd r9, r6 |
98 | subfic r9, r9, 63 |
99 | li r12, 63 |
100 | bne Lmid |
101 | b Lend |
102 | |
103 | .align 4 |
104 | Ltop: |
105 | and r4, r10, r0 |
106 | andc r5, r11, r0 |
107 | and r6, r3, r0 |
108 | andc r7, r30, r0 |
109 | or r3, r4, r5 |
110 | subf r9, r9, r12 |
111 | or r30, r6, r7 |
112 | Lmid: srd r3, r3, r9 |
113 | sub. r10, r30, r3 |
114 | subc r11, r3, r30 |
115 | neg r8, r10 |
116 | and r8, r8, r10 |
117 | subfe r0, r0, r0 |
118 | cntlzd r9, r8 |
119 | bne Ltop |
120 | |
121 | Lend: sld r3, r30, r31 |
122 | |
123 | addi r1, r1, 128 |
124 | ld r0, 16(r1) |
125 | ld r30, -16(r1) |
126 | ld r31, -8(r1) |
127 | mtlr r0 |
128 | blr |