From 12530dbee37f016821a4ac9a6f5521b4d7b170bd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 17 Jan 2000 16:30:17 -0800 Subject: [PATCH] combine.c (combine_simplify_rtx): Give FLOAT_STORE_FLAG_VALUE a mode. * combine.c (combine_simplify_rtx): Give FLOAT_STORE_FLAG_VALUE a mode. * cse.c (find_comparison_args, fold_rtx): Likewise. * integrate.c (subst_constants): Likewise. * loop.c (get_condition): Likewise. * tm.texi (FLOAT_STORE_FLAG_VALUE): Update docs. * alpha.h (FLOAT_STORE_FLAG_VALUE): Use REAL_VALUE_ATOF. From-SVN: r31479 --- gcc/ChangeLog | 11 +++++++++++ gcc/combine.c | 10 +++++++--- gcc/config/alpha/alpha.h | 3 ++- gcc/cse.c | 29 +++++++++++++++++++---------- gcc/integrate.c | 13 ++++++++++--- gcc/loop.c | 6 ++++-- gcc/tm.texi | 4 ++-- 7 files changed, 55 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d884eae3d21..e1f1277bf96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-01-17 Richard Henderson + + * combine.c (combine_simplify_rtx): Give FLOAT_STORE_FLAG_VALUE a mode. + * cse.c (find_comparison_args, fold_rtx): Likewise. + * integrate.c (subst_constants): Likewise. + * loop.c (get_condition): Likewise. + + * tm.texi (FLOAT_STORE_FLAG_VALUE): Update docs. + + * alpha.h (FLOAT_STORE_FLAG_VALUE): Use REAL_VALUE_ATOF. + 2000-01-18 Martin v. Löwis * c-parse.in (SAVE_WARN_FLAGS): Create an INTEGER_CST. diff --git a/gcc/combine.c b/gcc/combine.c index 4bf6dd83a57..99fe499756b 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3555,9 +3555,13 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) temp = simplify_relational_operation (code, op0_mode, XEXP (x, 0), XEXP (x, 1)); #ifdef FLOAT_STORE_FLAG_VALUE - if (temp != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - temp = ((temp == const0_rtx) ? CONST0_RTX (GET_MODE (x)) - : immed_real_const_1 (FLOAT_STORE_FLAG_VALUE, GET_MODE (x))); + if (temp != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT) + { + if (temp == const0_rtx) + temp = CONST0_RTX (mode); + else + temp = immed_real_const_1 (FLOAT_STORE_FLAG_VALUE (mode), mode); + } #endif break; case 'c': diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 09f897443f9..cf88a9aa339 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1674,7 +1674,8 @@ do { \ /* Define the value returned by a floating-point comparison instruction. */ -#define FLOAT_STORE_FLAG_VALUE (TARGET_FLOAT_VAX ? 0.5 : 2.0) +#define FLOAT_STORE_FLAG_VALUE(MODE) \ + REAL_VALUE_ATOF ((TARGET_FLOAT_VAX ? "0.5" : "2.0"), (MODE)) /* Canonicalize a comparison from one we don't have to one we do have. */ diff --git a/gcc/cse.c b/gcc/cse.c index 40d30a79d38..b346199097a 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2899,7 +2899,8 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) && code == LT && STORE_FLAG_VALUE == -1) #ifdef FLOAT_STORE_FLAG_VALUE || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1))))) #endif ) x = arg1; @@ -2908,7 +2909,8 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) && code == GE && STORE_FLAG_VALUE == -1) #ifdef FLOAT_STORE_FLAG_VALUE || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1))))) #endif ) x = arg1, reverse_code = 1; @@ -2954,7 +2956,8 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) #ifdef FLOAT_STORE_FLAG_VALUE || (code == LT && GET_MODE_CLASS (inner_mode) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1))))) #endif ) && GET_RTX_CLASS (GET_CODE (p->exp)) == '<')) @@ -2973,7 +2976,8 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) #ifdef FLOAT_STORE_FLAG_VALUE || (code == GE && GET_MODE_CLASS (inner_mode) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1))))) #endif ) && GET_RTX_CLASS (GET_CODE (p->exp)) == '<') @@ -3639,8 +3643,8 @@ fold_rtx (x, insn) #ifdef FLOAT_STORE_FLAG_VALUE if (GET_MODE_CLASS (mode) == MODE_FLOAT) { - true = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE, - mode); + true = (CONST_DOUBLE_FROM_REAL_VALUE + (FLOAT_STORE_FLAG_VALUE (mode), mode)); false = CONST0_RTX (mode); } #endif @@ -3753,8 +3757,8 @@ fold_rtx (x, insn) #ifdef FLOAT_STORE_FLAG_VALUE if (GET_MODE_CLASS (mode) == MODE_FLOAT) { - true = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE, - mode); + true = (CONST_DOUBLE_FROM_REAL_VALUE + (FLOAT_STORE_FLAG_VALUE (mode), mode)); false = CONST0_RTX (mode); } #endif @@ -3784,8 +3788,13 @@ fold_rtx (x, insn) const_arg1 ? const_arg1 : folded_arg1); #ifdef FLOAT_STORE_FLAG_VALUE if (new != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT) - new = ((new == const0_rtx) ? CONST0_RTX (mode) - : CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE, mode)); + { + if (new == const0_rtx) + new = CONST0_RTX (mode); + else + new = (CONST_DOUBLE_FROM_REAL_VALUE + (FLOAT_STORE_FLAG_VALUE (mode), mode)); + } #endif break; diff --git a/gcc/integrate.c b/gcc/integrate.c index bd48cd8e98d..0cbff9d05f3 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -2384,9 +2384,16 @@ subst_constants (loc, insn, map, memonly) XEXP (x, 0), XEXP (x, 1)); #ifdef FLOAT_STORE_FLAG_VALUE if (new != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - new = ((new == const0_rtx) ? CONST0_RTX (GET_MODE (x)) - : CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE, - GET_MODE (x))); + { + enum machine_mode mode = GET_MODE (x); + if (new == const0_rtx) + new = CONST0_RTX (mode); + else + { + REAL_VALUE_TYPE val = FLOAT_STORE_FLAG_VALUE (mode); + new = CONST_DOUBLE_FROM_REAL_VALUE (val, mode); + } + } #endif break; } diff --git a/gcc/loop.c b/gcc/loop.c index 88782f6db90..b02e4b0dc99 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -9103,7 +9103,8 @@ get_condition (jump, earliest) #ifdef FLOAT_STORE_FLAG_VALUE || (code == LT && GET_MODE_CLASS (inner_mode) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (inner_mode)))) #endif )) && GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<')) @@ -9122,7 +9123,8 @@ get_condition (jump, earliest) #ifdef FLOAT_STORE_FLAG_VALUE || (code == GE && GET_MODE_CLASS (inner_mode) == MODE_FLOAT - && FLOAT_STORE_FLAG_VALUE < 0) + && (REAL_VALUE_NEGATIVE + (FLOAT_STORE_FLAG_VALUE (inner_mode)))) #endif )) && GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<' diff --git a/gcc/tm.texi b/gcc/tm.texi index ed74148b351..d3357c1a4ef 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -7485,8 +7485,8 @@ You need not define @code{STORE_FLAG_VALUE} if the machine has no store-flag instructions. @findex FLOAT_STORE_FLAG_VALUE -@item FLOAT_STORE_FLAG_VALUE -A C expression that gives a non-zero floating point value that is +@item FLOAT_STORE_FLAG_VALUE (@var{mode}) +A C expression that gives a non-zero @code{REAL_VALUE_TYPE} value that is returned when comparison operators with floating-point results are true. Define this macro on machine that have comparison operations that return floating-point values. If there are no such operations, do not define -- 2.30.2