diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-11-06 15:58:46 +0100 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-11-06 15:58:46 +0100 |
commit | 66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35 (patch) | |
tree | 004642d484425eddaec7fdc33f68b1501c1ad104 /gdb/dfp.c | |
parent | 50637b26f85dc3e59b616f1b01ca8885cf98f0b4 (diff) | |
download | gdb-66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35.zip gdb-66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35.tar.gz gdb-66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35.tar.bz2 |
Target FP: Add binop and compare routines to target-float.{c,h}
This patch adds the following target floating-point routines:
- target_float_binop
- target_float_compare
which call the equivalent decimal_ routines to handle decimal FP,
and call helper routines that currently still go via DOUBLEST to
handle binary FP (derived from current valarith.c code).
These routines are used to handle both binary and decimal FP types
in scalar_binop, value_equal, and value_less, mostly following the
method currently used for decimal FP. The existing value_args_as_decimal
helper is renamed to value_args_as_target_float and extended to handle
both binary and decimal types.
The unary operations value_pos and value_neg are also simplified,
the former by using a simple copy for all scalar types, the latter
by using value_binop (... BINOP_SUB) to implement negation as
subtraction from zero.
ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c: Include <math.h>.
(floatformat_binop): New function.
(floatformat_compare): Likewise.
(target_float_binop): Likewise.
(target_float_compare): Likewise.
* target-float.h: Include "expression.h".
(target_float_binop): Add prototype.
(target_float_compare): Likewise.
* valarith.c: Do not include "doublest.h" and "dfp.h".
Include "common/byte-vector.h".
(value_args_as_decimal): Remove, replace by ...
(value_args_as_target_float): ... this function. Handle both
binary and decimal target floating-point formats.
(scalar_binop): Handle both binary and decimal FP using
value_args_as_target_float and target_float_binop.
(value_equal): Handle both binary and decimal FP using
value_args_as_target_float and target_float_compare.
(value_less): Likewise.
(value_pos): Handle all scalar types as simple copy.
(value_neg): Handle all scalar types via BINOP_SUB from 0.
* dfp.c (decimal_binop): Throw error instead of internal_error
when called with an unsupported operation code.
Diffstat (limited to 'gdb/dfp.c')
-rw-r--r-- | gdb/dfp.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -330,9 +330,8 @@ decimal_binop (enum exp_opcode op, case BINOP_EXP: decNumberPower (&number3, &number1, &number2, &set); break; - default: - internal_error (__FILE__, __LINE__, - _("Unknown decimal floating point operation.")); + default: + error (_("Operation not valid for decimal floating point number.")); break; } |