|
|
1.1 root 1: //////////
2: / libc/crt/i386/dcmp.s
3: / i386 C runtime library.
4: / IEEE software floating point support.
5: //////////
6:
7: //////////
8: / _dcmp(d) double d;
9: /
10: / Compare %edx:%eax to double d on stack, return flags set appropriately.
11: / Pops argument d before returning!
12: / Bogus for denormals.
13: //////////
14:
15: d .equ 4
16: SGNMASK .equ 0x80000000
17:
18: .globl _dcmp
19:
20: _dcmp: / Stack: hid lod ra
21: xchgl %ebx, d(%esp) / hid EBX ra, lod in EBX
22: xchgl %ecx, (%esp) / hid EBX ECX, ra in ECX
23: xchgl %ecx, d+4(%esp) / ra EBX ECX, d in ECX:EBX
24: push %esi / ra EBX ECX ESI
25: movl %esi, $1 / value for > to ESI
26: cmpl %ecx, $SGNMASK / be wary of arg -0.0
27: jnz ?L1
28: subl %ecx, %ecx / replace arg -0.0 with 0.0
29:
30: ?L1:
31: orl %edx, %edx
32: jns ?lhspos
33: cmpl %edx, $SGNMASK / be wary of lhs -0.0
34: jnz ?lhsneg
35: subl %edx, %edx / turn lhs -0.0 into 0.0
36:
37: ?lhspos: / lhs is positive
38: orl %ecx, %ecx
39: jns ?samesign / both positive
40: / else lhs positive, arg negative
41: ?done:
42: orl %esi, %esi
43:
44: ?quit:
45: pop %esi
46: pop %ecx
47: pop %ebx
48: ret
49:
50: ?samesign:
51: cmpl %edx, %ecx / both positive, compare magnitudes
52: ja ?done / lhs greater
53: jb ?less / lhs less
54: cmpl %eax, %ebx / hi equal, compare lo mantissa words
55: ja ?done
56: jz ?quit
57:
58: ?less:
59: negl %esi / negate result sense
60: jmp ?quit
61:
62: ?lhsneg: / lhs is negative
63: negl %esi / negate result sense
64: orl %ecx, %ecx
65: jns ?done / lhs negative, arg positive, return less
66: jmp ?samesign / both negative, compare magnitudes
67:
68: / end of libc/crt/i386/dcmp.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.