1 |
gbeauche |
1.3 |
#define DEFINE_X86_ASM_MACRO(name, value) \ |
2 |
|
|
asm(".local " #name "\n\t" #name " = " #value) |
3 |
|
|
|
4 |
|
|
DEFINE_X86_ASM_MACRO(BSUN, 0x00008000); |
5 |
|
|
DEFINE_X86_ASM_MACRO(SNAN, 0x00004000); |
6 |
|
|
DEFINE_X86_ASM_MACRO(OPERR, 0x00002000); |
7 |
|
|
DEFINE_X86_ASM_MACRO(OVFL, 0x00001000); |
8 |
|
|
DEFINE_X86_ASM_MACRO(UNFL, 0x00000800); |
9 |
|
|
DEFINE_X86_ASM_MACRO(DZ, 0x00000400); |
10 |
|
|
DEFINE_X86_ASM_MACRO(INEX2, 0x00000200); |
11 |
|
|
DEFINE_X86_ASM_MACRO(INEX1, 0x00000100); |
12 |
|
|
DEFINE_X86_ASM_MACRO(ACCR_IOP, 0x80); |
13 |
|
|
DEFINE_X86_ASM_MACRO(ACCR_OVFL, 0x40); |
14 |
|
|
DEFINE_X86_ASM_MACRO(ACCR_UNFL, 0x20); |
15 |
|
|
DEFINE_X86_ASM_MACRO(ACCR_DZ, 0x10); |
16 |
|
|
DEFINE_X86_ASM_MACRO(ACCR_INEX, 0x08); |
17 |
|
|
DEFINE_X86_ASM_MACRO(ROUND_CONTROL_MASK, 0x30); |
18 |
|
|
DEFINE_X86_ASM_MACRO(ROUND_TO_NEAREST, 0); |
19 |
|
|
DEFINE_X86_ASM_MACRO(ROUND_TO_ZERO, 0x10); |
20 |
|
|
DEFINE_X86_ASM_MACRO(ROUND_TO_NEGATIVE_INFINITY, 0x20); |
21 |
|
|
DEFINE_X86_ASM_MACRO(ROUND_TO_POSITIVE_INFINITY, 0x30); |
22 |
|
|
DEFINE_X86_ASM_MACRO(PRECISION_CONTROL_MASK, 0xC0); |
23 |
|
|
DEFINE_X86_ASM_MACRO(PRECISION_CONTROL_EXTENDED, 0); |
24 |
|
|
DEFINE_X86_ASM_MACRO(PRECISION_CONTROL_DOUBLE, 0x80); |
25 |
|
|
DEFINE_X86_ASM_MACRO(PRECISION_CONTROL_SINGLE, 0x40); |
26 |
|
|
DEFINE_X86_ASM_MACRO(PRECISION_CONTROL_UNDEFINED, 0xC0); |
27 |
|
|
DEFINE_X86_ASM_MACRO(CW_RESET, 0x0040); |
28 |
|
|
DEFINE_X86_ASM_MACRO(CW_FINIT, 0x037F); |
29 |
|
|
DEFINE_X86_ASM_MACRO(SW_RESET, 0x0000); |
30 |
|
|
DEFINE_X86_ASM_MACRO(SW_FINIT, 0x0000); |
31 |
|
|
DEFINE_X86_ASM_MACRO(TW_RESET, 0x5555); |
32 |
|
|
DEFINE_X86_ASM_MACRO(TW_FINIT, 0x0FFF); |
33 |
|
|
DEFINE_X86_ASM_MACRO(CW_X, 0x1000); |
34 |
|
|
DEFINE_X86_ASM_MACRO(CW_RC_ZERO, 0x0C00); |
35 |
|
|
DEFINE_X86_ASM_MACRO(CW_RC_UP, 0x0800); |
36 |
|
|
DEFINE_X86_ASM_MACRO(CW_RC_DOWN, 0x0400); |
37 |
|
|
DEFINE_X86_ASM_MACRO(CW_RC_NEAR, 0x0000); |
38 |
|
|
DEFINE_X86_ASM_MACRO(CW_PC_EXTENDED, 0x0300); |
39 |
|
|
DEFINE_X86_ASM_MACRO(CW_PC_DOUBLE, 0x0200); |
40 |
|
|
DEFINE_X86_ASM_MACRO(CW_PC_RESERVED, 0x0100); |
41 |
|
|
DEFINE_X86_ASM_MACRO(CW_PC_SINGLE, 0x0000); |
42 |
|
|
DEFINE_X86_ASM_MACRO(CW_PM, 0x0020); |
43 |
|
|
DEFINE_X86_ASM_MACRO(CW_UM, 0x0010); |
44 |
|
|
DEFINE_X86_ASM_MACRO(CW_OM, 0x0008); |
45 |
|
|
DEFINE_X86_ASM_MACRO(CW_ZM, 0x0004); |
46 |
|
|
DEFINE_X86_ASM_MACRO(CW_DM, 0x0002); |
47 |
|
|
DEFINE_X86_ASM_MACRO(CW_IM, 0x0001); |
48 |
|
|
DEFINE_X86_ASM_MACRO(SW_B, 0x8000); |
49 |
|
|
DEFINE_X86_ASM_MACRO(SW_C3, 0x4000); |
50 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_7, 0x3800); |
51 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_6, 0x3000); |
52 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_5, 0x2800); |
53 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_4, 0x2000); |
54 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_3, 0x1800); |
55 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_2, 0x1000); |
56 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_1, 0x0800); |
57 |
|
|
DEFINE_X86_ASM_MACRO(SW_TOP_0, 0x0000); |
58 |
|
|
DEFINE_X86_ASM_MACRO(SW_C2, 0x0400); |
59 |
|
|
DEFINE_X86_ASM_MACRO(SW_C1, 0x0200); |
60 |
|
|
DEFINE_X86_ASM_MACRO(SW_C0, 0x0100); |
61 |
|
|
DEFINE_X86_ASM_MACRO(SW_ES, 0x0080); |
62 |
|
|
DEFINE_X86_ASM_MACRO(SW_SF, 0x0040); |
63 |
|
|
DEFINE_X86_ASM_MACRO(SW_PE, 0x0020); |
64 |
|
|
DEFINE_X86_ASM_MACRO(SW_UE, 0x0010); |
65 |
|
|
DEFINE_X86_ASM_MACRO(SW_OE, 0x0008); |
66 |
|
|
DEFINE_X86_ASM_MACRO(SW_ZE, 0x0004); |
67 |
|
|
DEFINE_X86_ASM_MACRO(SW_DE, 0x0002); |
68 |
|
|
DEFINE_X86_ASM_MACRO(SW_IE, 0x0001); |
69 |
|
|
DEFINE_X86_ASM_MACRO(X86_ROUND_CONTROL_MASK, 0x0C00); |
70 |
|
|
DEFINE_X86_ASM_MACRO(X86_PRECISION_CONTROL_MASK, 0x0300); |
71 |
|
|
|
72 |
|
|
#undef DEFINE_X86_ASM_MACRO |
73 |
|
|
|
74 |
gbeauche |
1.1 |
/* |
75 |
|
|
#!/bin/sh |
76 |
|
|
|
77 |
|
|
awk=awk |
78 |
|
|
ifile="fpu_x86.h" |
79 |
|
|
ofile="fpu_x86_asm.h" |
80 |
|
|
|
81 |
|
|
if [ ! -r "$ifile" ]; then |
82 |
|
|
echo "Error: could not open input file ($ifile)" |
83 |
|
|
exit 1 |
84 |
|
|
fi |
85 |
|
|
|
86 |
|
|
touch $ofile |
87 |
|
|
if [ $? -ne 0 ]; then |
88 |
|
|
echo "Error: could not open output file ($ofile)" |
89 |
|
|
exit 1 |
90 |
|
|
fi |
91 |
|
|
|
92 |
|
|
# header |
93 |
|
|
cat > $ofile << EOF |
94 |
gbeauche |
1.3 |
#define DEFINE_X86_ASM_MACRO(name, value) \\ |
95 |
|
|
asm(".local " #name "\\n\\t" #name " = " #value) |
96 |
|
|
|
97 |
gbeauche |
1.1 |
EOF |
98 |
|
|
|
99 |
|
|
# processing with awk |
100 |
gbeauche |
1.3 |
$awk '/#define/ { print "DEFINE_X86_ASM_MACRO(" $2 ", " $3 ");"; }' $ifile >> $ofile |
101 |
gbeauche |
1.1 |
|
102 |
|
|
# footer |
103 |
|
|
cat >> $ofile << EOF |
104 |
gbeauche |
1.3 |
|
105 |
|
|
#undef DEFINE_X86_ASM_MACRO |
106 |
|
|
|
107 |
gbeauche |
1.1 |
EOF |
108 |
|
|
|
109 |
|
|
# insert this script |
110 |
|
|
echo "/""*" >> $ofile |
111 |
|
|
cat $0 >> $ofile |
112 |
|
|
echo "*""/" >> $ofile |
113 |
|
|
|
114 |
|
|
exit 0 |
115 |
|
|
*/ |