public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: "Andre Vieira (lists)" <andre.simoesdiasvieira@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	 Richard Sandiford <richard.sandiford@arm.com>,
	ebotcazou@gcc.gnu.org
Subject: Re: vect: Make vect_check_gather_scatter reject offsets that aren't multiples of BITS_PER_UNIT [PR107346]
Date: Mon, 24 Oct 2022 07:17:03 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2210240713450.4294@jbgna.fhfr.qr> (raw)
In-Reply-To: <129db1b0-0d2a-b768-bc80-9f73d665e8f8@arm.com>

[-- Attachment #1: Type: text/plain, Size: 2240 bytes --]

On Fri, 21 Oct 2022, Andre Vieira (lists) wrote:

> Hi,
> 
> The ada failure reported in the PR was being caused by
> vect_check_gather_scatter failing to deal with bit offsets that weren't
> multiples of BITS_PER_UNIT. This patch makes vect_check_gather_scatter reject
> memory accesses with such offsets.
> 
> Bootstrapped and regression tested on aarch64 and x86_64.
> 
> I wasn't sure whether I should add a new Ada test that shows the same failure
> without the bitfield lowering, I suspect this is such a rare form of
> data-structure that is why no other tests have highlighted the failure. Let me
> know if you would like me to add it still, the change is quite simple, just
> change the Int24 -> Int32 type in the structure. The 'thing' that causes the
> failure is the 4-bit member inside the packed structure before the field we
> access, giving it a 4-bit offset. I attempted but failed to create a C test
> using __attribute__((packed)).

Can you check why vect_find_stmt_data_reference doesn't trip on the

  if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
      && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
    {
      free_data_ref (dr);
      return opt_result::failure_at (stmt,
                                     "not vectorized:"
                                     " statement is an unsupported"
                                     " bitfield access %G", stmt);
    }

?  I think we should amend this check and I guess that
checking multiple_p on DECL_FIELD_BIT_OFFSET should be enough?

Eric - the docs of DECL_BIT_FIELD are vague enough "must be accessed
specially" but ISTR it might eventually only apply to the fields
(bit) size and not it's position.  OTOH the Ada frontend might not
be too careful in setting this flag for bit-packed structs?

Richard.

> Kind Regards,
> Andre
> 
> gcc/ChangeLog:
> 
>         PR tree-optimization/107346
>         * tree-vect-data-refs.cc (vect_check_gather_scatter): Reject 
> offsets that aren't
>         multiples of BITS_PER_UNIT.
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

  reply	other threads:[~2022-10-24  7:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 16:42 Andre Vieira (lists)
2022-10-24  7:17 ` Richard Biener [this message]
2022-10-24  8:31   ` Eric Botcazou
2022-10-24 10:31   ` Andre Vieira (lists)
2022-10-24 12:46     ` Richard Biener
2022-10-24 13:24       ` Andre Vieira (lists)
2022-10-24 13:29         ` Richard Biener
2022-10-28 13:43           ` Andre Vieira (lists)
2022-10-28 13:46             ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YFH.7.77.849.2210240713450.4294@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=andre.simoesdiasvieira@arm.com \
    --cc=ebotcazou@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).