public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
@ 2021-03-29  9:16 acoplan at gcc dot gnu.org
  2021-03-29  9:22 ` [Bug target/99813] [11 Regression] " ktkachov at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-03-29  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99813
           Summary: SVE: Invalid assembly at -O3 (multiplier out of range
                    in incb 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: ---

The following fails:

$ cat test.cc
long a, b;
bool c[2][14][2][16], f[2][14][2][16];
bool d;
char e[2][4][2][6];
void g() {
  a = 0;
  for (int h = 0; h < 2; ++h)
    for (int i = 0; i < 14; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 16; ++k)
          c[h][i][j][k] = 0;
  d = 0;
  for (int h; h < 2; ++h)
    for (int i = 0; i < 4; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 6; ++k)
          e[h][i][j][k] = 6;
  for (int h = 0; h < 2; ++h)
    for (int i = 0; i < 14; ++i)
      for (int j = 0; j < 2; ++j)
        for (int k = 0; k < 16; ++k)
          f[h][i][j][k] = b = 9;
}
$ aarch64-linux-gnu-gcc -c test.cc -O3 -march=armv8.2-a+sve
-fvect-cost-model=unlimited -fno-tree-dominator-opts -mtune=cortex-a72
/tmp/ccXhdoed.s: Assembler messages:
/tmp/ccXhdoed.s:647: Error: multiplier out of range 1 to 16 at operand 2 --
`incb x15,all,mul#28'

The choice of -mtune is questionable given that we've asked for SVE, but we
shouldn't generate invalid assembly in any case.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
@ 2021-03-29  9:22 ` ktkachov at gcc dot gnu.org
  2021-03-30  9:18 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2021-03-29  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.2.1
            Summary|SVE: Invalid assembly at    |[11 Regression] SVE:
                   |-O3 (multiplier out of      |Invalid assembly at -O3
                   |range in incb instruction)  |(multiplier out of range in
                   |                            |incb instruction)
   Target Milestone|---                         |11.0
                 CC|                            |ktkachov at gcc dot gnu.org
           Priority|P3                          |P1
   Last reconfirmed|                            |2021-03-29
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
  2021-03-29  9:22 ` [Bug target/99813] [11 Regression] " ktkachov at gcc dot gnu.org
@ 2021-03-30  9:18 ` jakub at gcc dot gnu.org
  2021-03-30  9:46 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-30  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the bug is in swapped constraints on add<mode>3_poly_1.
We have:
(define_constraint "Uai"
  "@internal
   A constraint that matches a VG-based constant that can be added by
   a single INC or DEC."
  (match_operand 0 "aarch64_sve_scalar_inc_dec_immediate"))

(define_constraint "Uav"
  "@internal
   A constraint that matches a VG-based constant that can be added by
   a single ADDVL or ADDPL."
 (match_operand 0 "aarch64_sve_addvl_addpl_immediate"))

and *add<mode>3_aarch64 has:
Uai,Uav
and matching output for those 2 constraints is:
  * return aarch64_output_sve_scalar_inc_dec (operands[2]);
  * return aarch64_output_sve_addvl_addpl (operands[2]);"
Now, *add<mode>3_poly_1 has:
Uav,Uai
and matching output for those 2 constraints is:
  * return aarch64_output_sve_scalar_inc_dec (operands[2]);
  * return aarch64_output_sve_addvl_addpl (operands[2]);
so IMHO, either we need to swap those 2 return lines, or do:
--- gcc/config/aarch64/aarch64.md.jj    2021-02-25 23:07:07.851319165 +0100
+++ gcc/config/aarch64/aarch64.md       2021-03-30 11:13:35.994077470 +0200
@@ -2051,7 +2051,7 @@
     (match_operand:GPI 0 "register_operand" "=r,r,r,r,r,r,&r")
     (plus:GPI
      (match_operand:GPI 1 "register_operand" "%rk,rk,rk,rk,rk,0,rk")
-     (match_operand:GPI 2 "aarch64_pluslong_or_poly_operand"
"I,r,J,Uaa,Uav,Uai,Uat")))]
+     (match_operand:GPI 2 "aarch64_pluslong_or_poly_operand"
"I,r,J,Uaa,Uai,Uav,Uat")))]
   "TARGET_SVE && operands[0] != stack_pointer_rtx"
   "@
   add\\t%<w>0, %<w>1, %2

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
  2021-03-29  9:22 ` [Bug target/99813] [11 Regression] " ktkachov at gcc dot gnu.org
  2021-03-30  9:18 ` jakub at gcc dot gnu.org
@ 2021-03-30  9:46 ` jakub at gcc dot gnu.org
  2021-03-30 15:20 ` rsandifo at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-30  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50487
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50487&action=edit
gcc11-pr99813.patch

Full untested fix.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-30  9:46 ` jakub at gcc dot gnu.org
@ 2021-03-30 15:20 ` rsandifo at gcc dot gnu.org
  2021-03-30 15:58 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-03-30 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Thanks for looking at this.  I agree swapping the constraints for
operand 2 looks like the right fix, and brings it into line with
*add<mode>3_aarch64".  I think we need to swap operand 1 too
though, since Uai needs tied registers but Uav doesn't.

I'll test with that change overnight.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-03-30 15:20 ` rsandifo at gcc dot gnu.org
@ 2021-03-30 15:58 ` jakub at gcc dot gnu.org
  2021-03-30 16:10 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-30 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Oops, totally missed that.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-03-30 15:58 ` jakub at gcc dot gnu.org
@ 2021-03-30 16:10 ` jakub at gcc dot gnu.org
  2021-03-31  8:48 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-30 16:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #50487|0                           |1
        is obsolete|                            |

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50489
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50489&action=edit
gcc11-pr99813.patch

Retesting this overnight too.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-03-30 16:10 ` jakub at gcc dot gnu.org
@ 2021-03-31  8:48 ` cvs-commit at gcc dot gnu.org
  2021-03-31  8:49 ` jakub at gcc dot gnu.org
  2021-03-31 13:29 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-31  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c001c194a2f73fb32461b597e91a35f9bbcf4414

commit r11-7924-gc001c194a2f73fb32461b597e91a35f9bbcf4414
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 31 10:46:01 2021 +0200

    aarch64: Fix up *add<mode>3_poly_1 [PR99813]

    As mentioned in the PR, Uai constraint stands for
    aarch64_sve_scalar_inc_dec_immediate
    while Uav for
    aarch64_sve_addvl_addpl_immediate.
    Both *add<mode>3_aarch64 and *add<mode>3_poly_1 patterns use
      * return aarch64_output_sve_scalar_inc_dec (operands[2]);
      * return aarch64_output_sve_addvl_addpl (operands[2]);
    in that order, but the former with Uai,Uav order, while the
    latter with Uav,Uai instead.  This patch swaps the constraints
    so that they match the output.

    Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>

    2021-03-31  Jakub Jelinek  <jakub@redhat.com>
                Richard Sandiford  <richard.sandiford@arm.com>

            PR target/99813
            * config/aarch64/aarch64.md (*add<mode>3_poly_1): Swap Uai and Uav
            constraints on operands[2] and similarly 0 and rk constraints
            on operands[1] corresponding to that.

            * g++.target/aarch64/sve/pr99813.C: New test.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-03-31  8:48 ` cvs-commit at gcc dot gnu.org
@ 2021-03-31  8:49 ` jakub at gcc dot gnu.org
  2021-03-31 13:29 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-31  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

* [Bug target/99813] [11 Regression] SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction)
  2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-03-31  8:49 ` jakub at gcc dot gnu.org
@ 2021-03-31 13:29 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-31 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:3753ceff562d8614a94a164b312f389812bd6cd8

commit r10-9641-g3753ceff562d8614a94a164b312f389812bd6cd8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 31 10:46:01 2021 +0200

    aarch64: Fix up *add<mode>3_poly_1 [PR99813]

    As mentioned in the PR, Uai constraint stands for
    aarch64_sve_scalar_inc_dec_immediate
    while Uav for
    aarch64_sve_addvl_addpl_immediate.
    Both *add<mode>3_aarch64 and *add<mode>3_poly_1 patterns use
      * return aarch64_output_sve_scalar_inc_dec (operands[2]);
      * return aarch64_output_sve_addvl_addpl (operands[2]);
    in that order, but the former with Uai,Uav order, while the
    latter with Uav,Uai instead.  This patch swaps the constraints
    so that they match the output.

    Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>

    2021-03-31  Jakub Jelinek  <jakub@redhat.com>
                Richard Sandiford  <richard.sandiford@arm.com>

            PR target/99813
            * config/aarch64/aarch64.md (*add<mode>3_poly_1): Swap Uai and Uav
            constraints on operands[2] and similarly 0 and rk constraints
            on operands[1] corresponding to that.

            * g++.target/aarch64/sve/pr99813.C: New test.

    (cherry picked from commit c001c194a2f73fb32461b597e91a35f9bbcf4414)

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

end of thread, other threads:[~2021-03-31 13:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  9:16 [Bug target/99813] New: SVE: Invalid assembly at -O3 (multiplier out of range in incb instruction) acoplan at gcc dot gnu.org
2021-03-29  9:22 ` [Bug target/99813] [11 Regression] " ktkachov at gcc dot gnu.org
2021-03-30  9:18 ` jakub at gcc dot gnu.org
2021-03-30  9:46 ` jakub at gcc dot gnu.org
2021-03-30 15:20 ` rsandifo at gcc dot gnu.org
2021-03-30 15:58 ` jakub at gcc dot gnu.org
2021-03-30 16:10 ` jakub at gcc dot gnu.org
2021-03-31  8:48 ` cvs-commit at gcc dot gnu.org
2021-03-31  8:49 ` jakub at gcc dot gnu.org
2021-03-31 13:29 ` cvs-commit 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).