This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about make_extraction() in combine.c


Hi!

On Tue, Aug 27, 2019 at 09:37:59AM -0700, Michael Eager wrote:
> Combine is complex, but I don't think that target descriptions should 
> conform to its behaviors;

But they have to, in some ways.  If combine writes something that can be
written in multiple ways in some way X, then your machine description has
to recognise X (perhaps in addition to other ways it can be written), or
you will not get as much optimisation as you might like: some combine
attempts will fail.

> combine should adapt to the target.

How?


> diff --git a/gcc/combine.c b/gcc/combine.c
> index 93bd3da26d7..fdc79ab7d3e 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -7777,17 +7777,7 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,

This patch is against some older version of combine.c?  The line number is
off by 70 or so.

>        && partial_subreg_p (extraction_mode, mode))
>      extraction_mode = mode;

And current trunk has here

  /* Punt if len is too large for extraction_mode.  */
  if (maybe_gt (len, GET_MODE_PRECISION (extraction_mode)))
    return NULL_RTX;

(See r268913, https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01140.html ).

Does that fix your problem already?  Is more needed?  Is your patch
removing some now-dead code?

> -  if (!MEM_P (inner))
> -    wanted_inner_mode = wanted_inner_reg_mode;
> -  else
> -    {
> -      /* Be careful not to go beyond the extracted object and maintain the
> -	 natural alignment of the memory.  */
> -      wanted_inner_mode = smallest_int_mode_for_size (len);
> -      while (pos % GET_MODE_BITSIZE (wanted_inner_mode) + len
> -	     > GET_MODE_BITSIZE (wanted_inner_mode))
> -	wanted_inner_mode = GET_MODE_WIDER_MODE (wanted_inner_mode).require ();
> -    }
> +  wanted_inner_mode = wanted_inner_reg_mode;


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]