Add support for fixed-point type arithmetic

This patch adds support for binary operations on fixed-point values,
as well as for the negative unary operator.

gdb/ChangeLog:

        * eval.c (binop_promote): Add fixed-point type handling.
        * valarith.c (fixed_point_binop): New function.
        (scalar_binop): Add fixed-point type handling.
        (value_neg): Add fixed-point type handling.
        * valops.c (value_cast_to_fixed_point): New function.
        (value_cast): Add fixed-point type handling.

gdb/testsuite/ChangeLog:

        * gdb.dwarf2/dw2-fixed-point.exp: Add arithmetic tests.
This commit is contained in:
Joel Brobecker
2020-11-15 03:17:12 -05:00
parent 0c9150e4de
commit 0a12719e51
6 changed files with 196 additions and 3 deletions

View File

@@ -430,6 +430,9 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
&& !is_integral_type (type2)))
return;
if (is_fixed_point_type (type1) || is_fixed_point_type (type2))
return;
if (type1->code () == TYPE_CODE_DECFLOAT
|| type2->code () == TYPE_CODE_DECFLOAT)
{