Revision 20495218 target-arm/nwfpe/fpa11.c
b/target-arm/nwfpe/fpa11.c | ||
---|---|---|
61 | 61 |
|
62 | 62 |
void SetRoundingMode(const unsigned int opcode) |
63 | 63 |
{ |
64 |
#if MAINTAIN_FPCR
|
|
64 |
int rounding_mode;
|
|
65 | 65 |
FPA11 *fpa11 = GET_FPA11(); |
66 |
|
|
67 |
#if MAINTAIN_FPCR |
|
66 | 68 |
fpa11->fpcr &= ~MASK_ROUNDING_MODE; |
67 | 69 |
#endif |
68 | 70 |
switch (opcode & MASK_ROUNDING_MODE) |
69 | 71 |
{ |
70 | 72 |
default: |
71 | 73 |
case ROUND_TO_NEAREST: |
72 |
float_rounding_mode = float_round_nearest_even;
|
|
74 |
rounding_mode = float_round_nearest_even; |
|
73 | 75 |
#if MAINTAIN_FPCR |
74 | 76 |
fpa11->fpcr |= ROUND_TO_NEAREST; |
75 | 77 |
#endif |
76 | 78 |
break; |
77 | 79 |
|
78 | 80 |
case ROUND_TO_PLUS_INFINITY: |
79 |
float_rounding_mode = float_round_up;
|
|
81 |
rounding_mode = float_round_up; |
|
80 | 82 |
#if MAINTAIN_FPCR |
81 | 83 |
fpa11->fpcr |= ROUND_TO_PLUS_INFINITY; |
82 | 84 |
#endif |
83 | 85 |
break; |
84 | 86 |
|
85 | 87 |
case ROUND_TO_MINUS_INFINITY: |
86 |
float_rounding_mode = float_round_down;
|
|
88 |
rounding_mode = float_round_down; |
|
87 | 89 |
#if MAINTAIN_FPCR |
88 | 90 |
fpa11->fpcr |= ROUND_TO_MINUS_INFINITY; |
89 | 91 |
#endif |
90 | 92 |
break; |
91 | 93 |
|
92 | 94 |
case ROUND_TO_ZERO: |
93 |
float_rounding_mode = float_round_to_zero;
|
|
95 |
rounding_mode = float_round_to_zero; |
|
94 | 96 |
#if MAINTAIN_FPCR |
95 | 97 |
fpa11->fpcr |= ROUND_TO_ZERO; |
96 | 98 |
#endif |
97 | 99 |
break; |
98 | 100 |
} |
101 |
set_float_rounding_mode(rounding_mode, &fpa11->fp_status); |
|
99 | 102 |
} |
100 | 103 |
|
101 | 104 |
void SetRoundingPrecision(const unsigned int opcode) |
102 | 105 |
{ |
103 |
#if MAINTAIN_FPCR
|
|
106 |
int rounding_precision;
|
|
104 | 107 |
FPA11 *fpa11 = GET_FPA11(); |
108 |
#if MAINTAIN_FPCR |
|
105 | 109 |
fpa11->fpcr &= ~MASK_ROUNDING_PRECISION; |
106 | 110 |
#endif |
107 | 111 |
switch (opcode & MASK_ROUNDING_PRECISION) |
108 | 112 |
{ |
109 | 113 |
case ROUND_SINGLE: |
110 |
floatx80_rounding_precision = 32;
|
|
114 |
rounding_precision = 32; |
|
111 | 115 |
#if MAINTAIN_FPCR |
112 | 116 |
fpa11->fpcr |= ROUND_SINGLE; |
113 | 117 |
#endif |
114 | 118 |
break; |
115 | 119 |
|
116 | 120 |
case ROUND_DOUBLE: |
117 |
floatx80_rounding_precision = 64;
|
|
121 |
rounding_precision = 64; |
|
118 | 122 |
#if MAINTAIN_FPCR |
119 | 123 |
fpa11->fpcr |= ROUND_DOUBLE; |
120 | 124 |
#endif |
121 | 125 |
break; |
122 | 126 |
|
123 | 127 |
case ROUND_EXTENDED: |
124 |
floatx80_rounding_precision = 80;
|
|
128 |
rounding_precision = 80; |
|
125 | 129 |
#if MAINTAIN_FPCR |
126 | 130 |
fpa11->fpcr |= ROUND_EXTENDED; |
127 | 131 |
#endif |
128 | 132 |
break; |
129 | 133 |
|
130 |
default: floatx80_rounding_precision = 80;
|
|
134 |
default: rounding_precision = 80; |
|
131 | 135 |
} |
136 |
set_floatx80_rounding_precision(rounding_precision, &fpa11->fp_status); |
|
132 | 137 |
} |
133 | 138 |
|
134 | 139 |
/* Emulate the instruction in the opcode. */ |
Also available in: Unified diff