aboutsummaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorJon Grimm <jgrimm2@us.ibm.com>2005-12-18 21:40:47 +0000
committerBen Elliston <bje@au.ibm.com>2005-12-18 21:40:47 +0000
commiteffb211327718a9334a993c09da4c114134d7377 (patch)
tree7e005c5de55a867524e5bf6183ab854c96880e3c /gcc/convert.c
parent3509dd42a46672e6993248a569a29adc24e5b5f4 (diff)
* optabs.c (init_floating_libfuncs): Handle decimal float modes.
(init_optabs): Handle libfuncs for decimal float. * genopinit.c (gen_insn): Handle MODE_DECIMAL_FLOAT. * stor-layout.c (int_mode_for_mode): Likewise. * simplify-rtx.c (simplify_immed_subreg): Likewise. (simplify_unary_operation_1): Skip optimisations for decimal float modes. * varasm.c (output_constant_pool_2): Handle MODE_DECIMAL_FLOAT. * emit-rtl.c (gen_const_vector): Add assertion check. (init_emit_once): Populate const_tiny_rtx with constants in each decimal float mode. * expmed.c (extract_high_half, expand_mult_highpart_optab, expand_mult_highpart): Assert that mode is not a scalar float mode. * expr.c (convert_move): Handle conversion between decimal and binary floats of the same size. * convert.c (convert_to_real): Consider decimal float types when folding. * dwarf2out.c (base_type_die): Use DW_ATE_decimal_float to describe decimal floating point types. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@108762 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 49d4a3ac5d6..e8030bf9f01 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -263,6 +263,28 @@ convert_to_real (tree type, tree expr)
&& FLOAT_TYPE_P (TREE_TYPE (arg1)))
{
tree newtype = type;
+
+ if (TYPE_MODE (TREE_TYPE (arg0)) == SDmode
+ || TYPE_MODE (TREE_TYPE (arg1)) == SDmode)
+ newtype = dfloat32_type_node;
+ if (TYPE_MODE (TREE_TYPE (arg0)) == DDmode
+ || TYPE_MODE (TREE_TYPE (arg1)) == DDmode)
+ newtype = dfloat64_type_node;
+ if (TYPE_MODE (TREE_TYPE (arg0)) == TDmode
+ || TYPE_MODE (TREE_TYPE (arg1)) == TDmode)
+ newtype = dfloat128_type_node;
+ if (newtype == dfloat32_type_node
+ || newtype == dfloat64_type_node
+ || newtype == dfloat128_type_node)
+ {
+ expr = build2 (TREE_CODE (expr), newtype,
+ fold (convert_to_real (newtype, arg0)),
+ fold (convert_to_real (newtype, arg1)));
+ if (newtype == type)
+ return expr;
+ break;
+ }
+
if (TYPE_PRECISION (TREE_TYPE (arg0)) > TYPE_PRECISION (newtype))
newtype = TREE_TYPE (arg0);
if (TYPE_PRECISION (TREE_TYPE (arg1)) > TYPE_PRECISION (newtype))