https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|riscv64-unknown-linux-gnu   |
            Summary|[10 Regression] RISC-V 64:  |RISC-V 64: inf/inf division
                   |inf/inf division optimized  |optimized out, invalid
                   |out, invalid operation not  |operation not raised
                   |raised                      |
   Last reconfirmed|                            |2020-05-14
     Ever confirmed|0                           |1
          Component|target                      |middle-end
              Build|riscv64-unknown-linux-gnu   |
               Host|riscv64-unknown-linux-gnu   |
             Status|UNCONFIRMED                 |NEW

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(simplify
 (rdiv @0 @0)
 (if (FLOAT_TYPE_P (type)
      && ! HONOR_NANS (type)
      && ! HONOR_INFINITIES (type))
  { build_one_cst (type); }))

so that's not it, possibly constant folding instead in const_binop.
There we only have

1276          /* Don't perform operation if we honor signaling NaNs and
1277             either operand is a signaling NaN.  */
1278          if (HONOR_SNANS (mode)
1279              && (REAL_VALUE_ISSIGNALING_NAN (d1)
1280                  || REAL_VALUE_ISSIGNALING_NAN (d2)))
1281            return NULL_TREE;

and

1283          /* Don't perform operation if it would raise a division
(gdb) 
1284             by zero exception.  */
1285          if (code == RDIV_EXPR
1286              && real_equal (&d2, &dconst0)
1287              && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
1288            return NULL_TREE;

which both don't trigger.  Afterwards

1309          inexact = real_arithmetic (&value, code, &d1, &d2);

even returns false and the result is a qNaN.

For the specific regression in this bug we now simply are able to
turn

    return u.x/v.x;

into a division of two constants.  That's nothing we're going to "fix",
so we have to fix the above instead which is a much older issue.

Reply via email to