This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [9/9] Make bitsize_mode_for_mode return an opt_mode
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Sandiford <richard dot sandiford at linaro dot org>
- Date: Tue, 5 Sep 2017 13:39:26 +0200
- Subject: Re: [9/9] Make bitsize_mode_for_mode return an opt_mode
- Authentication-results: sourceware.org; auth=none
- References: <87tw0iiu51.fsf@linaro.org> <87pob6hep8.fsf@linaro.org>
On Mon, Sep 4, 2017 at 1:43 PM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> 2017-09-04 Richard Sandiford <richard.sandiford@linaro.org>
Ok.
Richard.
> gcc/
> * machmode.h (bitwise_mode_for_mode): Return opt_mode.
> * stor-layout.c (bitwise_mode_for_mode): Likewise.
> (bitwise_type_for_mode): Update accordingly.
>
> Index: gcc/machmode.h
> ===================================================================
> --- gcc/machmode.h 2017-09-04 12:18:55.821333642 +0100
> +++ gcc/machmode.h 2017-09-04 12:19:42.856108173 +0100
> @@ -694,7 +694,7 @@ smallest_int_mode_for_size (unsigned int
> }
>
> extern opt_scalar_int_mode int_mode_for_mode (machine_mode);
> -extern machine_mode bitwise_mode_for_mode (machine_mode);
> +extern opt_machine_mode bitwise_mode_for_mode (machine_mode);
> extern opt_machine_mode mode_for_vector (scalar_mode, unsigned);
> extern opt_machine_mode mode_for_int_vector (unsigned int, unsigned int);
>
> Index: gcc/stor-layout.c
> ===================================================================
> --- gcc/stor-layout.c 2017-09-04 12:19:01.144339518 +0100
> +++ gcc/stor-layout.c 2017-09-04 12:19:42.856108173 +0100
> @@ -404,10 +404,10 @@ int_mode_for_mode (machine_mode mode)
> }
> }
>
> -/* Find a mode that can be used for efficient bitwise operations on MODE.
> - Return BLKmode if no such mode exists. */
> +/* Find a mode that can be used for efficient bitwise operations on MODE,
> + if one exists. */
>
> -machine_mode
> +opt_machine_mode
> bitwise_mode_for_mode (machine_mode mode)
> {
> /* Quick exit if we already have a suitable mode. */
> @@ -445,7 +445,7 @@ bitwise_mode_for_mode (machine_mode mode
> }
>
> /* Otherwise fall back on integers while honoring MAX_FIXED_MODE_SIZE. */
> - return mode_for_size (bitsize, MODE_INT, true).else_blk ();
> + return mode_for_size (bitsize, MODE_INT, true);
> }
>
> /* Find a type that can be used for efficient bitwise operations on MODE.
> @@ -454,8 +454,7 @@ bitwise_mode_for_mode (machine_mode mode
> tree
> bitwise_type_for_mode (machine_mode mode)
> {
> - mode = bitwise_mode_for_mode (mode);
> - if (mode == BLKmode)
> + if (!bitwise_mode_for_mode (mode).exists (&mode))
> return NULL_TREE;
>
> unsigned int inner_size = GET_MODE_UNIT_BITSIZE (mode);