Commit 0b59f49d by Ben Elliston

dfp.c (decimal_real_arithmetic): Change second argument type from int to enum tree_code.

	* dfp.c (decimal_real_arithmetic): Change second argument type
	from int to enum tree_code. Do not always return true, but now
	return result of any call to decimal_do helper functions.
	* dfp.h (decimal_real_arithmetic): Update prototype.

From-SVN: r110626
parent 3ded6210
2006-02-04 Ben Elliston <bje@au.ibm.com>
* dfp.c (decimal_real_arithmetic): Change second argument type
from int to enum tree_code. Do not always return true, but now
return result of any call to decimal_do helper functions.
* dfp.h (decimal_real_arithmetic): Update prototype.
2006-02-05 Eric Botcazou <ebotcazou@libertysurf.fr> 2006-02-05 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sol2-bi.h (SPARC_DEFAULT_CMODEL): Set to CM_MEDMID. * config/sparc/sol2-bi.h (SPARC_DEFAULT_CMODEL): Set to CM_MEDMID.
...@@ -934,11 +941,11 @@ ...@@ -934,11 +941,11 @@
PR ada/25900 PR ada/25900
* tree-vrp.c (extract_range_from_assert): When merging a VR_RANGE * tree-vrp.c (extract_range_from_assert): When merging a VR_RANGE
with a VR_ANTI_RANGE and the VR_ANTI_RANGEis completely contained with a VR_ANTI_RANGE and the VR_ANTI_RANGE is completely contained
within the VR_RANGE, use the VR_RANGE as the result, not the within the VR_RANGE, use the VR_RANGE as the result, not the
VR_ANTI_RANGE. VR_ANTI_RANGE.
(adjust_range_with_scev): Reject ranges from SCEV which are out (adjust_range_with_scev): Reject ranges from SCEV which are out of
of bounds for the type. bounds for the type.
2006-01-26 Daniel Berlin <dberlin@dberlin.org> 2006-01-26 Daniel Berlin <dberlin@dberlin.org>
......
/* Decimal floating point support. /* Decimal floating point support.
Copyright (C) 2005 Free Software Foundation, Inc. Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -597,49 +597,42 @@ decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh, ...@@ -597,49 +597,42 @@ decimal_real_to_integer2 (HOST_WIDE_INT *plow, HOST_WIDE_INT *phigh,
real_to_integer2 (plow, phigh, &to); real_to_integer2 (plow, phigh, &to);
} }
/* Perform the decimal floating point operation described by COODE. /* Perform the decimal floating point operation described by CODE.
For a unary operation, leave OP1 NULL. This function returns true For a unary operation, OP1 will be NULL. This function returns
if the result may be inexact due to loss of precision. */ true if the result may be inexact due to loss of precision. */
bool bool
decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode, decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code,
const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op0,
const REAL_VALUE_TYPE *op1) const REAL_VALUE_TYPE *op1)
{ {
enum tree_code code = icode; REAL_VALUE_TYPE a, b;
REAL_VALUE_TYPE a1;
REAL_VALUE_TYPE b1;
/* If either op is not a decimal, create a temporary decimal /* If either operand is non-decimal, create temporaries. */
versions. */
if (!op0->decimal) if (!op0->decimal)
{ {
decimal_from_binary (&a1, op0); decimal_from_binary (&a, op0);
op0 = &a1; op0 = &a;
} }
if (op1 && !op1->decimal) if (op1 && !op1->decimal)
{ {
decimal_from_binary (&b1, op1); decimal_from_binary (&b, op1);
op1 = &b1; op1 = &b;
} }
switch (code) switch (code)
{ {
case PLUS_EXPR: case PLUS_EXPR:
(void) decimal_do_add (r, op0, op1, 0); return decimal_do_add (r, op0, op1, 0);
break;
case MINUS_EXPR: case MINUS_EXPR:
(void) decimal_do_add (r, op0, op1, 1); return decimal_do_add (r, op0, op1, 1);
break;
case MULT_EXPR: case MULT_EXPR:
(void) decimal_do_multiply (r, op0, op1); return decimal_do_multiply (r, op0, op1);
break;
case RDIV_EXPR: case RDIV_EXPR:
(void) decimal_do_divide (r, op0, op1); return decimal_do_divide (r, op0, op1);
break;
case MIN_EXPR: case MIN_EXPR:
if (op1->cl == rvc_nan) if (op1->cl == rvc_nan)
...@@ -648,7 +641,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode, ...@@ -648,7 +641,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode,
*r = *op0; *r = *op0;
else else
*r = *op1; *r = *op1;
break; return false;
case MAX_EXPR: case MAX_EXPR:
if (op1->cl == rvc_nan) if (op1->cl == rvc_nan)
...@@ -657,7 +650,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode, ...@@ -657,7 +650,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode,
*r = *op1; *r = *op1;
else else
*r = *op0; *r = *op0;
break; return false;
case NEGATE_EXPR: case NEGATE_EXPR:
{ {
...@@ -669,7 +662,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode, ...@@ -669,7 +662,7 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode,
/* Keep sign field in sync. */ /* Keep sign field in sync. */
r->sign ^= 1; r->sign ^= 1;
} }
break; return false;
case ABS_EXPR: case ABS_EXPR:
{ {
...@@ -681,19 +674,15 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode, ...@@ -681,19 +674,15 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, int icode,
/* Keep sign field in sync. */ /* Keep sign field in sync. */
r->sign = 0; r->sign = 0;
} }
break; return false;
case FIX_TRUNC_EXPR: case FIX_TRUNC_EXPR:
decimal_do_fix_trunc (r, op0); decimal_do_fix_trunc (r, op0);
break; return false;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
/* FIXME: Indicate all operations as inexact for now due to unknown
working precision. */
return true;
} }
/* Fills R with the largest finite value representable in mode MODE. /* Fills R with the largest finite value representable in mode MODE.
......
/* Decimal floating point support functions for GNU compiler. /* Decimal floating point support functions for GNU compiler.
Copyright (C) 2005 Free Software Foundation, Inc. Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -38,7 +38,7 @@ void decimal_round_for_format (const struct real_format *, REAL_VALUE_TYPE *); ...@@ -38,7 +38,7 @@ void decimal_round_for_format (const struct real_format *, REAL_VALUE_TYPE *);
void decimal_real_convert (REAL_VALUE_TYPE *, enum machine_mode, const REAL_VALUE_TYPE *); void decimal_real_convert (REAL_VALUE_TYPE *, enum machine_mode, const REAL_VALUE_TYPE *);
void decimal_real_to_decimal (char *, const REAL_VALUE_TYPE *, size_t, size_t, int); void decimal_real_to_decimal (char *, const REAL_VALUE_TYPE *, size_t, size_t, int);
void decimal_do_fix_trunc (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); void decimal_do_fix_trunc (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
bool decimal_real_arithmetic (REAL_VALUE_TYPE *, int, const REAL_VALUE_TYPE *, bool decimal_real_arithmetic (REAL_VALUE_TYPE *, enum tree_code, const REAL_VALUE_TYPE *,
const REAL_VALUE_TYPE *); const REAL_VALUE_TYPE *);
void decimal_real_maxval (REAL_VALUE_TYPE *, int, enum machine_mode); void decimal_real_maxval (REAL_VALUE_TYPE *, int, enum machine_mode);
void decimal_real_to_integer2 (HOST_WIDE_INT *, HOST_WIDE_INT *, const REAL_VALUE_TYPE *); void decimal_real_to_integer2 (HOST_WIDE_INT *, HOST_WIDE_INT *, const REAL_VALUE_TYPE *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment