This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about make_extraction() in combine.c
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Michael Eager <eager at eagerm dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Wed, 28 Aug 2019 14:33:36 -0500
- Subject: Re: Question about make_extraction() in combine.c
- References: <71017eb1-ed7e-ec1d-1b4e-c1f973b08489@eagerm.com> <20181116225022.GM23873@gate.crashing.org> <58f36a40-b9e5-2321-c58c-93a61531add9@eagerm.com> <3b59ae65-1431-a251-aaf8-98a5121ca2a4@redhat.com> <51ebe5de-28b3-5d15-a63a-11ccccf8a86e@eagerm.com> <9e7ea648-6b85-1371-3f7c-5410ffdac07d@redhat.com> <fe5c0776-d14a-6d91-2ac0-ee1514b7d5e3@eagerm.com> <118d5c40-fab8-5ef3-992e-bf0253735d42@redhat.com> <8b9c993b-3cf5-4fff-c0e3-81b17ee8c2e0@eagerm.com>
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