This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/37489] In cse.c:fold_rtx(), "true" is represented in floating-point modes as const_true_rtx, if FLOAT_STORE_FLAG_VALUE is undefined.
- From: "raksit at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2008 18:54:26 -0000
- Subject: [Bug target/37489] In cse.c:fold_rtx(), "true" is represented in floating-point modes as const_true_rtx, if FLOAT_STORE_FLAG_VALUE is undefined.
- References: <bug-37489-15599@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from raksit at gcc dot gnu dot org 2008-09-12 18:54 -------
(In reply to comment #4)
> We can't define FLOAT_STORE_FLAG_VALUE for SSE since we can't
> represent 0xfffffff as a valid FP value. This patch makes
> fold_rtx to match simplify_relational_operation:
>
> --- ./cse.c.foo 2008-09-08 10:46:09.000000000 -0700
> +++ ./cse.c 2008-09-12 10:46:18.000000000 -0700
> @@ -3217,14 +3217,16 @@ fold_rtx (rtx x, rtx insn)
> rtx true_rtx = const_true_rtx, false_rtx = const0_rtx;
> enum machine_mode mode_arg1;
>
> -#ifdef FLOAT_STORE_FLAG_VALUE
> if (SCALAR_FLOAT_MODE_P (mode))
> {
> +#ifdef FLOAT_STORE_FLAG_VALUE
> true_rtx = (CONST_DOUBLE_FROM_REAL_VALUE
> (FLOAT_STORE_FLAG_VALUE (mode), mode));
> +#else
> + true_rtx = NULL_RTX;
> +#endif
> false_rtx = CONST0_RTX (mode);
> }
> -#endif
>
> code = find_comparison_args (code, &folded_arg0, &folded_arg1,
> &mode_arg0, &mode_arg1);
> @@ -3332,8 +3334,17 @@ fold_rtx (rtx x, rtx insn)
> const_arg1))
> || (REG_P (folded_arg1)
> && (REG_QTY (REGNO (folded_arg1)) ==
> ent->comparison_qty))))
> - return (comparison_dominates_p (ent->comparison_code,
> code)
> - ? true_rtx : false_rtx);
> + {
> + if (comparison_dominates_p (ent->comparison_code,
> code))
> + {
> + if (true_rtx)
> + return true_rtx;
> + else
> + break;
> + }
> + else
> + return false_rtx;
> + }
> }
> }
> }
>
I had a similar patch in mind. In case it helps, I have attached a testcase
that you can use for the submission. You might also want to fix the gcc-4.3
branch.
-raksit
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37489