Christophe Lyon via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> @@ -19352,7 +19363,9 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx 
> x)
>  {
>    /* Support CSE and rematerialization of common constants.  */
>    if (CONST_INT_P (x)
> -      || (CONST_DOUBLE_P (x) && GET_MODE_CLASS (mode) == MODE_FLOAT))
> +      || (CONST_DOUBLE_P (x)
> +       && (GET_MODE_CLASS (mode) == MODE_FLOAT
> +           || GET_MODE_CLASS (mode) == MODE_DECIMAL_FLOAT)))
>      return true;
>  
>    /* Only accept variable-length vector constants if they can be

I'd prefer to remove the mode check here, rather than extend it.
If we see a CONST_DOUBLE that doesn't have a scalar float mode
then something has gone wrong.  (No need to assert for that though.
It's a fundamental assumption when TARGET_SUPPORTS_WIDE_INT.)

For consistency…

> @@ -11114,11 +11116,16 @@ aarch64_float_const_rtx_p (rtx x)
>    return false;
>  }
>  
> -/* Return TRUE if rtx X is immediate constant 0.0 */
> +/* Return TRUE if rtx X is immediate constant 0.0 (but not in Decimal
> +   Floating Point).  */
>  bool
>  aarch64_float_const_zero_rtx_p (rtx x)
>  {
> -  if (GET_MODE (x) == VOIDmode)
> +  if (GET_MODE (x) == VOIDmode
> +      /* 0.0 in Decimal Floating Point cannot be represented by #0 or
> +      zr as our callers expect, so no need to check the actual
> +      value if X is of Decimal Floating Point type.  */
> +      || GET_MODE_CLASS (GET_MODE (x)) == MODE_DECIMAL_FLOAT)

…it would be good to drop the VOIDmode check here at the same time.

OK with those changes, thanks.

Richard

Reply via email to