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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Dominik Vogt from comment #4)
> What happens in Cse1 is that the constant is propagated into the
> FLOAT_EXTEND expression, resulting in
> 
>   (float_expand:DD (const_double:SD -9223372036854775808))
> 
> which is eventually simplified using simplify_const_unary_operation.  This
> has a case dealing with FLOAT_EXTEND:
> 
>         case FLOAT_EXTEND: 
>           /* All this does is change the mode, unless changing 
>              mode class.  */ 
>           /* Don't perform the operation if flag_signaling_nans is on 
>              and the operand is a signaling NaN.  */ 
>           if ((GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)) 
>                || d.decimal) 
>               && !(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d))) 
>             real_convert (&d, mode, &d); 
>           break; 
> 
> This test fails, so the following code just strips the FLOAT_EXTEND:DD and
> replaces the mode in const_double with the target mode:
> 
>   (const_double:DD -9223372036854775808)
> 
> which is wrong.  Shouldn't this truncate the constant to the source mode
> first before converting it to the target mode?

This isn't truncation, but extension (SDmode to DDmode).  I presume all SDmode
values are representable in DDmode, so I don't see anything wrong on that.

Reply via email to