This source file includes following definitions.
- reg_mul
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include "exception.h"
18 #include "reg_constant.h"
19 #include "fpu_emu.h"
20 #include "fpu_system.h"
21
22
23
24 int reg_mul(FPU_REG const *a, FPU_REG const *b,
25 FPU_REG *dest, unsigned int control_w)
26 {
27 char saved_sign = dest->sign;
28 char sign = (a->sign ^ b->sign);
29
30 if (!(a->tag | b->tag))
31 {
32
33 dest->sign = sign;
34 if ( reg_u_mul(a, b, dest, control_w) )
35 {
36 dest->sign = saved_sign;
37 return 1;
38 }
39 return 0;
40 }
41 else if ((a->tag <= TW_Zero) && (b->tag <= TW_Zero))
42 {
43 #ifdef DENORM_OPERAND
44 if ( ((b->tag == TW_Valid) && (b->exp <= EXP_UNDER)) ||
45 ((a->tag == TW_Valid) && (a->exp <= EXP_UNDER)) )
46 {
47 if ( denormal_operand() ) return 1;
48 }
49 #endif DENORM_OPERAND
50
51
52
53 reg_move(&CONST_Z, dest);
54
55
56
57 dest->sign = sign;
58 return 0;
59 }
60 else
61 {
62
63 if ( (a->tag == TW_NaN) || (b->tag == TW_NaN) )
64 { return real_2op_NaN(a, b, dest); }
65 else if (a->tag == TW_Infinity)
66 {
67 if (b->tag == TW_Zero)
68 { return arith_invalid(dest); }
69 else
70 {
71 #ifdef DENORM_OPERAND
72 if ( (b->tag == TW_Valid) && (b->exp <= EXP_UNDER) &&
73 denormal_operand() )
74 return 1;
75 #endif DENORM_OPERAND
76 reg_move(a, dest);
77 dest->sign = sign;
78 }
79 return 0;
80 }
81 else if (b->tag == TW_Infinity)
82 {
83 if (a->tag == TW_Zero)
84 { return arith_invalid(dest); }
85 else
86 {
87 #ifdef DENORM_OPERAND
88 if ( (a->tag == TW_Valid) && (a->exp <= EXP_UNDER) &&
89 denormal_operand() )
90 return 1;
91 #endif DENORM_OPERAND
92 reg_move(b, dest);
93 dest->sign = sign;
94 }
95 return 0;
96 }
97 #ifdef PARANOID
98 else
99 {
100 EXCEPTION(EX_INTERNAL|0x102);
101 return 1;
102 }
103 #endif PARANOID
104 }
105 }