public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction
@ 2021-03-18 15:01 acoplan at gcc dot gnu.org
  2021-03-18 15:15 ` [Bug target/99647] " acoplan at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-03-18 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99647
           Summary: arm: GCC generates invalid MVE vmov instruction
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

We generate invalid assembly for the following testcase:

$ cat test.c
typedef int __attribute((vector_size(16))) V;
V f(void) {
  return (V){ (int)f, (int)f, (int)f, (int)f };
}
$ arm-eabi-gcc -c test.c -O2 -march=armv8.1-m.main+mve -mfloat-abi=hard
/tmp/ccSbIMAM.s: Assembler messages:
/tmp/ccSbIMAM.s:29: Error: expected <Rm> or <Dm> or <Qm> operand -- `vmov.32
q0,#f'

It looks like we're trying to use a label on the RHS of a vmov instruction:

f:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        vmov.32 q0, #f
        bx      lr

This can also be seen through autovec in the testsuite. In particular
gcc/testsuite/gcc.dg/torture/pr47958-1.c fails at -O3 in the same way:

$ arm-eabi-gcc -c gcc/testsuite/gcc.dg/torture/pr47958-1.c -c -O3
-march=armv8.1-m.main+mve -mfloat-abi=hard
/tmp/cc09hQWF.s: Assembler messages:
/tmp/cc09hQWF.s:42: Error: expected <Rm> or <Dm> or <Qm> operand -- `vmov.32
q3,#bar'

I noticed this while working on PR97252 which is a separate problem with MVE
vector moves.

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
@ 2021-03-18 15:15 ` acoplan at gcc dot gnu.org
  2021-04-01 10:43 ` acoplan at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-03-18 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Also fails for GCC 10. Not sure if this counts as a regression since MVE only
went in with GCC 10.

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
  2021-03-18 15:15 ` [Bug target/99647] " acoplan at gcc dot gnu.org
@ 2021-04-01 10:43 ` acoplan at gcc dot gnu.org
  2021-04-08  8:37 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-01 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |acoplan at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-01
     Ever confirmed|0                           |1

--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Taking a look at this.

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
  2021-03-18 15:15 ` [Bug target/99647] " acoplan at gcc dot gnu.org
  2021-04-01 10:43 ` acoplan at gcc dot gnu.org
@ 2021-04-08  8:37 ` cvs-commit at gcc dot gnu.org
  2021-04-08  8:40 ` acoplan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-08  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alex Coplan <acoplan@gcc.gnu.org>:

https://gcc.gnu.org/g:67d56b272021363eb58c319ca3b73beba3a60817

commit r11-8038-g67d56b272021363eb58c319ca3b73beba3a60817
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Thu Apr 8 09:36:57 2021 +0100

    arm: Various MVE vec_duplicate fixes [PR99647]

    This patch fixes various issues with vec_duplicate in the MVE patterns.
    Currently there are two patterns named *mve_mov<mode>. The second of
    these is really a vector duplicate rather than a move, so I've renamed
    it accordingly.

    As it stands, there are several issues with this pattern:
    1. The MVE_types iterator has an entry for TImode, but
       vec_duplicate:TI is invalid.
    2. The mode of the operand to vec_duplicate is SImode, but it should
       vary according to the vector mode iterator.
    3. The second alternative of this pattern is bogus: it allows matching
       symbol_refs (the cause of the PR) and const_ints (which means that it
       matches (vec_duplicate (const_int ...)) which is non-canonical: such
       rtxes should be const_vectors instead and handled by the main vector
       move pattern).

    This patch fixes all of these issues, and removes the redundant
    *mve_vec_duplicate<mode> pattern.

    gcc/ChangeLog:

            PR target/99647
            * config/arm/iterators.md (MVE_vecs): New.
            (V_elem): Also handle V2DF.
            * config/arm/mve.md (*mve_mov<mode>): Rename to ...
            (*mve_vdup<mode>): ... this. Remove second alternative since
            vec_duplicate of const_int is not canonical RTL, and we don't
            want to match symbol_refs.
            (*mve_vec_duplicate<mode>): Delete (pattern is redundant).

    gcc/testsuite/ChangeLog:

            PR target/99647
            * gcc.c-torture/compile/pr99647.c: New test.

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-04-08  8:37 ` cvs-commit at gcc dot gnu.org
@ 2021-04-08  8:40 ` acoplan at gcc dot gnu.org
  2021-04-26 21:11 ` cvs-commit at gcc dot gnu.org
  2021-04-26 21:12 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-08  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-04-08  8:40 ` acoplan at gcc dot gnu.org
@ 2021-04-26 21:11 ` cvs-commit at gcc dot gnu.org
  2021-04-26 21:12 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-26 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Alex Coplan
<acoplan@gcc.gnu.org>:

https://gcc.gnu.org/g:9266a101ac9707a164bd241c00675a45aae01373

commit r10-9770-g9266a101ac9707a164bd241c00675a45aae01373
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Thu Apr 8 09:36:57 2021 +0100

    arm: Various MVE vec_duplicate fixes [PR99647]

    This patch fixes various issues with vec_duplicate in the MVE patterns.
    Currently there are two patterns named *mve_mov<mode>. The second of
    these is really a vector duplicate rather than a move, so I've renamed
    it accordingly.

    As it stands, there are several issues with this pattern:
    1. The MVE_types iterator has an entry for TImode, but
       vec_duplicate:TI is invalid.
    2. The mode of the operand to vec_duplicate is SImode, but it should
       vary according to the vector mode iterator.
    3. The second alternative of this pattern is bogus: it allows matching
       symbol_refs (the cause of the PR) and const_ints (which means that it
       matches (vec_duplicate (const_int ...)) which is non-canonical: such
       rtxes should be const_vectors instead and handled by the main vector
       move pattern).

    This patch fixes all of these issues, and removes the redundant
    *mve_vec_duplicate<mode> pattern.

    gcc/ChangeLog:

            PR target/99647
            * config/arm/iterators.md (MVE_vecs): New.
            (V_elem): Also handle V2DF.
            * config/arm/mve.md (*mve_mov<mode>): Rename to ...
            (*mve_vdup<mode>): ... this. Remove second alternative since
            vec_duplicate of const_int is not canonical RTL, and we don't
            want to match symbol_refs.
            (*mve_vec_duplicate<mode>): Delete (pattern is redundant).

    gcc/testsuite/ChangeLog:

            PR target/99647
            * gcc.c-torture/compile/pr99647.c: New test.

    (cherry picked from commit 67d56b272021363eb58c319ca3b73beba3a60817)

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

* [Bug target/99647] arm: GCC generates invalid MVE vmov instruction
  2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-04-26 21:11 ` cvs-commit at gcc dot gnu.org
@ 2021-04-26 21:12 ` acoplan at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-26 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

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

--- Comment #6 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Fixed for GCC 10.4 so fixed everywhere.

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

end of thread, other threads:[~2021-04-26 21:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 15:01 [Bug target/99647] New: arm: GCC generates invalid MVE vmov instruction acoplan at gcc dot gnu.org
2021-03-18 15:15 ` [Bug target/99647] " acoplan at gcc dot gnu.org
2021-04-01 10:43 ` acoplan at gcc dot gnu.org
2021-04-08  8:37 ` cvs-commit at gcc dot gnu.org
2021-04-08  8:40 ` acoplan at gcc dot gnu.org
2021-04-26 21:11 ` cvs-commit at gcc dot gnu.org
2021-04-26 21:12 ` acoplan 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).