Target FP: Add binop and compare routines to target-float.{c,h}
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 6 Nov 2017 14:58:46 +0000 (15:58 +0100)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 6 Nov 2017 14:58:46 +0000 (15:58 +0100)
commit66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35
tree004642d484425eddaec7fdc33f68b1501c1ad104
parent50637b26f85dc3e59b616f1b01ca8885cf98f0b4
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.
gdb/ChangeLog
gdb/dfp.c
gdb/target-float.c
gdb/target-float.h
gdb/valarith.c
This page took 0.02514 seconds and 4 git commands to generate.