aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-float.h
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-11-06 15:58:46 +0100
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-11-06 15:58:46 +0100
commit66c02b9ed1eabf1d7981c0c27ec9fd3c17fc5d35 (patch)
tree004642d484425eddaec7fdc33f68b1501c1ad104 /gdb/target-float.h
parent50637b26f85dc3e59b616f1b01ca8885cf98f0b4 (diff)
downloadgdb-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/target-float.h')
-rw-r--r--gdb/target-float.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/target-float.h b/gdb/target-float.h
index 9ea1812..466dd1b 100644
--- a/gdb/target-float.h
+++ b/gdb/target-float.h
@@ -20,6 +20,8 @@
#ifndef TYPED_FLOAT_H
#define TYPED_FLOAT_H
+#include "expression.h"
+
extern bool target_float_is_valid (const gdb_byte *addr,
const struct type *type);
extern bool target_float_is_zero (const gdb_byte *addr,
@@ -44,4 +46,11 @@ extern void target_float_convert (const gdb_byte *from,
const struct type *from_type,
gdb_byte *to, const struct type *to_type);
+extern void target_float_binop (enum exp_opcode opcode,
+ const gdb_byte *x, const struct type *type_x,
+ const gdb_byte *y, const struct type *type_y,
+ gdb_byte *res, const struct type *type_res);
+extern int target_float_compare (const gdb_byte *x, const struct type *type_x,
+ const gdb_byte *y, const struct type *type_y);
+
#endif