summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-03-14 14:02:10 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-03-14 14:02:10 +0000
commit9ce37dcfc8bf630a81315f182ee9f3102128becc (patch)
tree72dc4ff5c660048c298d80243ea16ff9e4568de0 /gcc/cse.c
parenta40164455fb34aac28fd646ba9de12eef80e692d (diff)
downloadgcc-9ce37dcfc8bf630a81315f182ee9f3102128becc.tar.gz
* cse.c (check_fold_consts): New static function.
(cfc_args): New struct. (simplify_relational_operation): Use them in call to `do_float_handler'. * toplev.c (do_float_handler): New function to wrap calls to setjmp/set_float_handler. * toplev.h (do_float_handler): Add extern prototype. * tree.c (build_real_from_int_cst_1): New static function. (brfic_args): New struct. (build_real_from_int_cst): Use them in call to `do_float_handler'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25768 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 7d9690899e5..bc22df9e2c8 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -664,6 +664,7 @@ static void cse_set_around_loop PROTO((rtx, rtx, rtx));
static rtx cse_basic_block PROTO((rtx, rtx, struct branch_path *, int));
static void count_reg_usage PROTO((rtx, int *, rtx, int));
extern void dump_class PROTO((struct table_elt*));
+static void check_fold_consts PROTO((PTR));
extern int rtx_equal_function_value_matters;
@@ -4594,6 +4595,28 @@ cse_gen_binary (code, mode, op0, op1)
return gen_rtx_fmt_ee (code, mode, op0, op1);
}
+struct cfc_args
+{
+ /* Input */
+ rtx op0, op1;
+ /* Output */
+ int equal, op0lt, op1lt;
+};
+
+static void
+check_fold_consts (data)
+ PTR data;
+{
+ struct cfc_args * args = (struct cfc_args *) data;
+ REAL_VALUE_TYPE d0, d1;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (d0, args->op0);
+ REAL_VALUE_FROM_CONST_DOUBLE (d1, args->op1);
+ args->equal = REAL_VALUES_EQUAL (d0, d1);
+ args->op0lt = REAL_VALUES_LESS (d0, d1);
+ args->op1lt = REAL_VALUES_LESS (d1, d0);
+}
+
/* Like simplify_binary_operation except used for relational operators.
MODE is the mode of the operands, not that of the result. If MODE
is VOIDmode, both operands must also be VOIDmode and we compare the
@@ -4655,19 +4678,20 @@ simplify_relational_operation (code, mode, op0, op1)
else if (GET_CODE (op0) == CONST_DOUBLE && GET_CODE (op1) == CONST_DOUBLE
&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT)
{
- REAL_VALUE_TYPE d0, d1;
- jmp_buf handler;
+ struct cfc_args args;
+
+ /* Setup input for check_fold_consts() */
+ args.op0 = op0;
+ args.op1 = op1;
- if (setjmp (handler))
+ if (do_float_handler(check_fold_consts, (PTR) &args) == 0)
+ /* We got an exception from check_fold_consts() */
return 0;
- set_float_handler (handler);
- REAL_VALUE_FROM_CONST_DOUBLE (d0, op0);
- REAL_VALUE_FROM_CONST_DOUBLE (d1, op1);
- equal = REAL_VALUES_EQUAL (d0, d1);
- op0lt = op0ltu = REAL_VALUES_LESS (d0, d1);
- op1lt = op1ltu = REAL_VALUES_LESS (d1, d0);
- set_float_handler (NULL_PTR);
+ /* Receive output from check_fold_consts() */
+ equal = args.equal;
+ op0lt = op0ltu = args.op0lt;
+ op1lt = op1ltu = args.op1lt;
}
#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */