LGTM, thanks :)

On Mon, Dec 2, 2024 at 6:00 PM Andreas Schwab <sch...@suse.de> wrote:
>
>         * config/riscv/riscv.cc (fli_value_hf, fli_value_sf)
>         (fli_value_df): Use integer constants.  Constify.
>         (riscv_float_const_rtx_index_for_fli): Add const.
> ---
>  gcc/config/riscv/riscv.cc | 64 ++++++++++++++++++++++++---------------
>  1 file changed, 39 insertions(+), 25 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index 7a1724d6e73..0a6c00926b3 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -1637,35 +1637,49 @@ static int riscv_symbol_insns (enum riscv_symbol_type 
> type)
>     Manual draft. For details, please see:
>     https://github.com/riscv/riscv-isa-manual/releases/tag/isa-449cd0c  */
>
> -static unsigned HOST_WIDE_INT fli_value_hf[32] =
> -{
> -  0xbcp8, 0x4p8, 0x1p8, 0x2p8, 0x1cp8, 0x20p8, 0x2cp8, 0x30p8,
> -  0x34p8, 0x35p8, 0x36p8, 0x37p8, 0x38p8, 0x39p8, 0x3ap8, 0x3bp8,
> -  0x3cp8, 0x3dp8, 0x3ep8, 0x3fp8, 0x40p8, 0x41p8, 0x42p8, 0x44p8,
> -  0x48p8, 0x4cp8, 0x58p8, 0x5cp8, 0x78p8,
> +static const unsigned HOST_WIDE_INT fli_value_hf[32] =
> +{
> +#define P8(v) ((unsigned HOST_WIDE_INT) (v) << 8)
> +  P8(0xbc), P8(0x4), P8(0x1), P8(0x2),
> +  P8(0x1c), P8(0x20), P8(0x2c), P8(0x30),
> +  P8(0x34), P8(0x35), P8(0x36), P8(0x37),
> +  P8(0x38), P8(0x39), P8(0x3a), P8(0x3b),
> +  P8(0x3c), P8(0x3d), P8(0x3e), P8(0x3f),
> +  P8(0x40), P8(0x41), P8(0x42), P8(0x44),
> +  P8(0x48), P8(0x4c), P8(0x58), P8(0x5c),
> +  P8(0x78),
>    /* Only used for filling, ensuring that 29 and 30 of HF are the same.  */
> -  0x78p8,
> -  0x7cp8, 0x7ep8
> +  P8(0x78),
> +  P8(0x7c), P8(0x7e)
> +#undef P8
>  };
>
> -static unsigned HOST_WIDE_INT fli_value_sf[32] =
> -{
> -  0xbf8p20, 0x008p20, 0x378p20, 0x380p20, 0x3b8p20, 0x3c0p20, 0x3d8p20, 
> 0x3e0p20,
> -  0x3e8p20, 0x3eap20, 0x3ecp20, 0x3eep20, 0x3f0p20, 0x3f2p20, 0x3f4p20, 
> 0x3f6p20,
> -  0x3f8p20, 0x3fap20, 0x3fcp20, 0x3fep20, 0x400p20, 0x402p20, 0x404p20, 
> 0x408p20,
> -  0x410p20, 0x418p20, 0x430p20, 0x438p20, 0x470p20, 0x478p20, 0x7f8p20, 
> 0x7fcp20
> +static const unsigned HOST_WIDE_INT fli_value_sf[32] =
> +{
> +#define P20(v) ((unsigned HOST_WIDE_INT) (v) << 20)
> +  P20(0xbf8), P20(0x008), P20(0x378), P20(0x380),
> +  P20(0x3b8), P20(0x3c0), P20(0x3d8), P20(0x3e0),
> +  P20(0x3e8), P20(0x3ea), P20(0x3ec), P20(0x3ee),
> +  P20(0x3f0), P20(0x3f2), P20(0x3f4), P20(0x3f6),
> +  P20(0x3f8), P20(0x3fa), P20(0x3fc), P20(0x3fe),
> +  P20(0x400), P20(0x402), P20(0x404), P20(0x408),
> +  P20(0x410), P20(0x418), P20(0x430), P20(0x438),
> +  P20(0x470), P20(0x478), P20(0x7f8), P20(0x7fc)
> +#undef P20
>  };
>
> -static unsigned HOST_WIDE_INT fli_value_df[32] =
> -{
> -  0xbff0p48, 0x10p48, 0x3ef0p48, 0x3f00p48,
> -  0x3f70p48, 0x3f80p48, 0x3fb0p48, 0x3fc0p48,
> -  0x3fd0p48, 0x3fd4p48, 0x3fd8p48, 0x3fdcp48,
> -  0x3fe0p48, 0x3fe4p48, 0x3fe8p48, 0x3fecp48,
> -  0x3ff0p48, 0x3ff4p48, 0x3ff8p48, 0x3ffcp48,
> -  0x4000p48, 0x4004p48, 0x4008p48, 0x4010p48,
> -  0x4020p48, 0x4030p48, 0x4060p48, 0x4070p48,
> -  0x40e0p48, 0x40f0p48, 0x7ff0p48, 0x7ff8p48
> +static const unsigned HOST_WIDE_INT fli_value_df[32] =
> +{
> +#define P48(v) ((unsigned HOST_WIDE_INT) (v) << 48)
> +  P48(0xbff0), P48(0x10), P48(0x3ef0), P48(0x3f00),
> +  P48(0x3f70), P48(0x3f80), P48(0x3fb0), P48(0x3fc0),
> +  P48(0x3fd0), P48(0x3fd4), P48(0x3fd8), P48(0x3fdc),
> +  P48(0x3fe0), P48(0x3fe4), P48(0x3fe8), P48(0x3fec),
> +  P48(0x3ff0), P48(0x3ff4), P48(0x3ff8), P48(0x3ffc),
> +  P48(0x4000), P48(0x4004), P48(0x4008), P48(0x4010),
> +  P48(0x4020), P48(0x4030), P48(0x4060), P48(0x4070),
> +  P48(0x40e0), P48(0x40f0), P48(0x7ff0), P48(0x7ff8)
> +#undef P48
>  };
>
>  /* Display floating-point values at the assembly level, which is consistent
> @@ -1686,7 +1700,7 @@ const char *fli_value_print[32] =
>  int
>  riscv_float_const_rtx_index_for_fli (rtx x)
>  {
> -  unsigned HOST_WIDE_INT *fli_value_array;
> +  const unsigned HOST_WIDE_INT *fli_value_array;
>
>    machine_mode mode = GET_MODE (x);
>
> --
> 2.47.1
>
>
> --
> Andreas Schwab, SUSE Labs, sch...@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Reply via email to