public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2
@ 2022-11-16 12:56 kevin.bracey at alifsemi dot com
  2022-11-16 15:52 ` [Bug target/107714] " kevin.bracey at alifsemi dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kevin.bracey at alifsemi dot com @ 2022-11-16 12:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

            Bug ID: 107714
           Summary: MVE: Invalid addressing mode generated for VLD2
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kevin.bracey at alifsemi dot com
  Target Milestone: ---

Created attachment 53909
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53909&action=edit
Stripped-down reproducer source

While I was working on some Helium intrinsics, GCC produced some invalid code,
meaning my optimisation can only be enabled in our armclang builds. Problem
seems to be still present on GCC trunk.

Posted at https://godbolt.org/z/h3EhMvxao

Compilation options -O2 -mcpu=cortex-m55 -mfloat-abi=hard

Error: instruction does not accept this addressing mode -- `vld21.8
{q4,q5},[r3],r2'

Compiler Explorer output for trunk shows the same invalid addressing mode.

(It also shows non-existent registers q8 and up in use - I don't know why. Not
a problem in my local GCC, obtained from Arm's embedded distribution).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
@ 2022-11-16 15:52 ` kevin.bracey at alifsemi dot com
  2022-11-16 16:00 ` kevin.bracey at alifsemi dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kevin.bracey at alifsemi dot com @ 2022-11-16 15:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #1 from Kevin Bracey <kevin.bracey at alifsemi dot com> ---
Looking at that assembly output from Compiler Explorer, I'm also at a loss as
to what happened to the "6" for the VMUL. Maybe something else to look at?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
  2022-11-16 15:52 ` [Bug target/107714] " kevin.bracey at alifsemi dot com
@ 2022-11-16 16:00 ` kevin.bracey at alifsemi dot com
  2022-11-17 16:43 ` stammark at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kevin.bracey at alifsemi dot com @ 2022-11-16 16:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

Kevin Bracey <kevin.bracey at alifsemi dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stammark at gcc dot gnu.org

--- Comment #2 from Kevin Bracey <kevin.bracey at alifsemi dot com> ---
Ah, the vmulq is falling foul of some sort of generic selection problem.
Substituting with vmulq_n_u8() gets me the actual 6.

Something in the same area as my bug 107515, perhaps - I've been making liberal
use of the generic functions.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
  2022-11-16 15:52 ` [Bug target/107714] " kevin.bracey at alifsemi dot com
  2022-11-16 16:00 ` kevin.bracey at alifsemi dot com
@ 2022-11-17 16:43 ` stammark at gcc dot gnu.org
  2022-11-21 12:12 ` kevin.bracey at alifsemi dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stammark at gcc dot gnu.org @ 2022-11-17 16:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

Stam Markianos-Wright <stammark at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-11-17

--- Comment #3 from Stam Markianos-Wright <stammark at gcc dot gnu.org> ---
Thanks for finding this! Confirmed the `vld2` bug on latest trunk -- my guess
would be either a GCC backend or a gas bug (I'm not familiar with these
instructions).

For the `vmulq` issue I'll reply under the other thread, but I believe that
very soon we'll be able to put that down as "already fixed", so we can keep
this thread for `vld2` only.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (2 preceding siblings ...)
  2022-11-17 16:43 ` stammark at gcc dot gnu.org
@ 2022-11-21 12:12 ` kevin.bracey at alifsemi dot com
  2022-11-21 12:49 ` kevin.bracey at alifsemi dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kevin.bracey at alifsemi dot com @ 2022-11-21 12:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #4 from Kevin Bracey <kevin.bracey at alifsemi dot com> ---
The assembler's rejection of the vld2 is valid - the only permitted
post-indexed form is to use "!" for increment by 32 (the amount read).

Experimenting by changing "inStep" you can see the compiler backend knows that
32 is the only valid constant offset - it generates the "!" form for that
correctly - but it apparently hasn't been told not to use register offsets.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (3 preceding siblings ...)
  2022-11-21 12:12 ` kevin.bracey at alifsemi dot com
@ 2022-11-21 12:49 ` kevin.bracey at alifsemi dot com
  2022-12-09 13:29 ` stammark at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kevin.bracey at alifsemi dot com @ 2022-11-21 12:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #5 from Kevin Bracey <kevin.bracey at alifsemi dot com> ---
I had a look at the GCC source. The vld2/vst2/vld4/vst4 instructions in mve.md
have reused the "Um" constraint used for vld<N>/vst<N> in Neon, which permits
both "!" and register offset.

This needs to be tightened up - can't see an existing equivalent constraint.
Perhaps "Um" can be given variant MVE/Neon behaviour, like "Uj".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (4 preceding siblings ...)
  2022-11-21 12:49 ` kevin.bracey at alifsemi dot com
@ 2022-12-09 13:29 ` stammark at gcc dot gnu.org
  2022-12-30 11:25 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stammark at gcc dot gnu.org @ 2022-12-09 13:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

Stam Markianos-Wright <stammark at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
            Version|12.2.0                      |13.0
      Known to fail|                            |11.3.1, 12.2.1
     Ever confirmed|0                           |1
   Last reconfirmed|2022-11-17 00:00:00         |2022-12-09

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (5 preceding siblings ...)
  2022-12-09 13:29 ` stammark at gcc dot gnu.org
@ 2022-12-30 11:25 ` cvs-commit at gcc dot gnu.org
  2023-01-10 13:38 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-30 11:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Stam Markianos-Wright
<stammark@gcc.gnu.org>:

https://gcc.gnu.org/g:4269a6567eb991e6838f40bda5be9e3a7972530c

commit r13-4935-g4269a6567eb991e6838f40bda5be9e3a7972530c
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Date:   Fri Dec 30 11:25:22 2022 +0000

    Fix memory constraint on MVE v[ld/st][2/4] instructions [PR107714]

    In the M-Class Arm-ARM:

    https://developer.arm.com/documentation/ddi0553/bu/?lang=en

    these MVE instructions only have '!' writeback variant and at:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

    we found that the Um constraint would also allow through a
    register offset writeback, resulting in an assembler error.

    Here I have added a new constraint and predicate for these
    instructions, which (uniquely, AFAICT), only support a `!` writeback
    increment by the data size (inside the compiler this is a POST_INC).

    No regressions in arm-none-eabi with MVE and MVE.FP.

    gcc/ChangeLog:
            PR target/107714
            * config/arm/arm-protos.h (mve_struct_mem_operand): New protoype.
            * config/arm/arm.cc (mve_struct_mem_operand): New function.
            * config/arm/constraints.md (Ug): New constraint.
            * config/arm/mve.md (mve_vst4q<mode>): Change constraint.
            (mve_vst2q<mode>): Likewise.
            (mve_vld4q<mode>): Likewise.
            (mve_vld2q<mode>): Likewise.
            * config/arm/predicates.md (mve_struct_operand): New predicate.

    gcc/testsuite/ChangeLog:
            PR target/107714
            * gcc.target/arm/mve/intrinsics/vldst24q_reg_offset.c: New test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (6 preceding siblings ...)
  2022-12-30 11:25 ` cvs-commit at gcc dot gnu.org
@ 2023-01-10 13:38 ` cvs-commit at gcc dot gnu.org
  2023-01-10 13:41 ` cvs-commit at gcc dot gnu.org
  2023-01-16 13:22 ` stammark at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-10 13:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Stam Markianos-Wright
<stammark@gcc.gnu.org>:

https://gcc.gnu.org/g:08842ad274f5e2630994f7c6e70b2d31768107ea

commit r11-10461-g08842ad274f5e2630994f7c6e70b2d31768107ea
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Date:   Fri Dec 30 11:25:22 2022 +0000

    Fix memory constraint on MVE v[ld/st][2/4] instructions [PR107714]

    In the M-Class Arm-ARM:

    https://developer.arm.com/documentation/ddi0553/bu/?lang=en

    these MVE instructions only have '!' writeback variant and at:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

    we found that the Um constraint would also allow through a
    register offset writeback, resulting in an assembler error.

    Here I have added a new constraint and predicate for these
    instructions, which (uniquely, AFAICT), only support a `!` writeback
    increment by the data size (inside the compiler this is a POST_INC).

    No regressions in arm-none-eabi with MVE and MVE.FP.

    gcc/ChangeLog:
            PR target/107714
            * config/arm/arm-protos.h (mve_struct_mem_operand): New protoype.
            * config/arm/arm.c (mve_struct_mem_operand): New function.
            * config/arm/constraints.md (Ug): New constraint.
            * config/arm/mve.md (mve_vst4q<mode>): Change constraint.
            (mve_vst2q<mode>): Likewise.
            (mve_vld4q<mode>): Likewise.
            (mve_vld2q<mode>): Likewise.
            * config/arm/predicates.md (mve_struct_operand): New predicate.

    gcc/testsuite/ChangeLog:
            PR target/107714
            * gcc.target/arm/mve/intrinsics/vldst24q_reg_offset.c: New test.

    (cherry picked from commit 4269a6567eb991e6838f40bda5be9e3a7972530c)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (7 preceding siblings ...)
  2023-01-10 13:38 ` cvs-commit at gcc dot gnu.org
@ 2023-01-10 13:41 ` cvs-commit at gcc dot gnu.org
  2023-01-16 13:22 ` stammark at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-10 13:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Stam Markianos-Wright
<stammark@gcc.gnu.org>:

https://gcc.gnu.org/g:25edc76f2afba0b4eaf22174d42de042a6969dbe

commit r12-9038-g25edc76f2afba0b4eaf22174d42de042a6969dbe
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Date:   Fri Dec 30 11:25:22 2022 +0000

    Fix memory constraint on MVE v[ld/st][2/4] instructions [PR107714]

    In the M-Class Arm-ARM:

    https://developer.arm.com/documentation/ddi0553/bu/?lang=en

    these MVE instructions only have '!' writeback variant and at:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

    we found that the Um constraint would also allow through a
    register offset writeback, resulting in an assembler error.

    Here I have added a new constraint and predicate for these
    instructions, which (uniquely, AFAICT), only support a `!` writeback
    increment by the data size (inside the compiler this is a POST_INC).

    No regressions in arm-none-eabi with MVE and MVE.FP.

    gcc/ChangeLog:
            PR target/107714
            * config/arm/arm-protos.h (mve_struct_mem_operand): New protoype.
            * config/arm/arm.cc (mve_struct_mem_operand): New function.
            * config/arm/constraints.md (Ug): New constraint.
            * config/arm/mve.md (mve_vst4q<mode>): Change constraint.
            (mve_vst2q<mode>): Likewise.
            (mve_vld4q<mode>): Likewise.
            (mve_vld2q<mode>): Likewise.
            * config/arm/predicates.md (mve_struct_operand): New predicate.

    gcc/testsuite/ChangeLog:
            PR target/107714
            * gcc.target/arm/mve/intrinsics/vldst24q_reg_offset.c: New test.

    (cherry picked from commit 4269a6567eb991e6838f40bda5be9e3a7972530c)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/107714] MVE: Invalid addressing mode generated for VLD2
  2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
                   ` (8 preceding siblings ...)
  2023-01-10 13:41 ` cvs-commit at gcc dot gnu.org
@ 2023-01-16 13:22 ` stammark at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: stammark at gcc dot gnu.org @ 2023-01-16 13:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

Stam Markianos-Wright <stammark at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Stam Markianos-Wright <stammark at gcc dot gnu.org> ---
This should now be resolved on all active branches (11, 12, 13)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-16 13:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 12:56 [Bug target/107714] New: MVE: Invalid addressing mode generated for VLD2 kevin.bracey at alifsemi dot com
2022-11-16 15:52 ` [Bug target/107714] " kevin.bracey at alifsemi dot com
2022-11-16 16:00 ` kevin.bracey at alifsemi dot com
2022-11-17 16:43 ` stammark at gcc dot gnu.org
2022-11-21 12:12 ` kevin.bracey at alifsemi dot com
2022-11-21 12:49 ` kevin.bracey at alifsemi dot com
2022-12-09 13:29 ` stammark at gcc dot gnu.org
2022-12-30 11:25 ` cvs-commit at gcc dot gnu.org
2023-01-10 13:38 ` cvs-commit at gcc dot gnu.org
2023-01-10 13:41 ` cvs-commit at gcc dot gnu.org
2023-01-16 13:22 ` stammark at gcc dot gnu.org

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).