This source file includes following definitions.
- fld_const
- fld1
- fldl2t
- fldl2e
- fldpi
- fldlg2
- fldln2
- fldz
- fconst
1
2
3
4
5
6
7
8
9
10
11
12
13 #include "fpu_system.h"
14 #include "fpu_emu.h"
15 #include "status_w.h"
16 #include "reg_constant.h"
17
18
19 FPU_REG CONST_1 = { SIGN_POS, TW_Valid, EXP_BIAS,
20 0x00000000, 0x80000000 };
21 FPU_REG CONST_2 = { SIGN_POS, TW_Valid, EXP_BIAS+1,
22 0x00000000, 0x80000000 };
23 FPU_REG CONST_HALF = { SIGN_POS, TW_Valid, EXP_BIAS-1,
24 0x00000000, 0x80000000 };
25 FPU_REG CONST_L2T = { SIGN_POS, TW_Valid, EXP_BIAS+1,
26 0xcd1b8afe, 0xd49a784b };
27 FPU_REG CONST_L2E = { SIGN_POS, TW_Valid, EXP_BIAS,
28 0x5c17f0bc, 0xb8aa3b29 };
29 FPU_REG CONST_PI = { SIGN_POS, TW_Valid, EXP_BIAS+1,
30 0x2168c235, 0xc90fdaa2 };
31 FPU_REG CONST_PI2 = { SIGN_POS, TW_Valid, EXP_BIAS,
32 0x2168c235, 0xc90fdaa2 };
33 FPU_REG CONST_PI4 = { SIGN_POS, TW_Valid, EXP_BIAS-1,
34 0x2168c235, 0xc90fdaa2 };
35 FPU_REG CONST_LG2 = { SIGN_POS, TW_Valid, EXP_BIAS-2,
36 0xfbcff799, 0x9a209a84 };
37 FPU_REG CONST_LN2 = { SIGN_POS, TW_Valid, EXP_BIAS-1,
38 0xd1cf79ac, 0xb17217f7 };
39
40
41 FPU_REG CONST_Z = { SIGN_POS, TW_Zero, 0, 0x0, 0x0 };
42
43
44
45
46
47
48 FPU_REG CONST_QNaN = { SIGN_NEG, TW_NaN, EXP_OVER, 0x00000000, 0xC0000000 };
49
50
51 FPU_REG CONST_INF = { SIGN_POS, TW_Infinity, EXP_OVER, 0x00000000, 0x80000000 };
52
53
54
55 static void fld_const(FPU_REG *c)
56 {
57 FPU_REG *st_new_ptr;
58
59 if ( STACK_OVERFLOW )
60 {
61 stack_overflow();
62 return;
63 }
64 push();
65 reg_move(c, FPU_st0_ptr);
66 status_word &= ~SW_C1;
67 }
68
69
70 static void fld1(void)
71 {
72 fld_const(&CONST_1);
73 }
74
75 static void fldl2t(void)
76 {
77 fld_const(&CONST_L2T);
78 }
79
80 static void fldl2e(void)
81 {
82 fld_const(&CONST_L2E);
83 }
84
85 static void fldpi(void)
86 {
87 fld_const(&CONST_PI);
88 }
89
90 static void fldlg2(void)
91 {
92 fld_const(&CONST_LG2);
93 }
94
95 static void fldln2(void)
96 {
97 fld_const(&CONST_LN2);
98 }
99
100 static void fldz(void)
101 {
102 fld_const(&CONST_Z);
103 }
104
105 static FUNC constants_table[] = {
106 fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, Un_impl
107 };
108
109 void fconst(void)
110 {
111 (constants_table[FPU_rm])();
112 }