public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics
@ 2021-11-05  9:50 tnfchris at gcc dot gnu.org
  2021-11-05  9:50 ` [Bug target/103094] " tnfchris at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-11-05  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103094
           Summary: [12 Regression] Incorrect codegen from AArch64
                    intrinsics
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*

The following testcase

---

#include <arm_neon.h>

void foo (uint8x8x2_t cols_01_23, uint8x8x2_t cols_45_67, uint16_t* outptr0)
{
  uint16x4x4_t cols_01_23_45_67 = { {
    vreinterpret_u16_u8(cols_01_23.val[0]),
    vreinterpret_u16_u8(cols_01_23.val[1]),
    vreinterpret_u16_u8(cols_45_67.val[0]),
    vreinterpret_u16_u8(cols_45_67.val[1])
  } };

  vst4_lane_u16(outptr0, cols_01_23_45_67, 0);
}

---

Causes incorrect codegen

```
foo:
        mov     v4.8b, v0.8b
        mov     v5.8b, v1.8b
        mov     v6.8b, v1.8b
        mov     v7.8b, v2.8b
        st4     {v4.h - v7.h}[0], [x0]
        ret
```

as the same register `v1` is used as source for two inputs.

This happens in cprop_hardreg where a correct RTL

```
(insn 20 37 26 2 (set (reg:V4HI 61 v29 [ __val+8 ])
        (reg:V4HI 36 v4 [ cols_01_23+8 ])) 1158 {*aarch64_simd_movv4hi}
     (nil))
```

is turned into

```
(insn 20 37 26 2 (set (reg:V4HI 61 v29 [ __val+8 ])
        (reg:V4HI 33 v1 [orig:36 cols_01_23+8 ] [36])) 1158
{*aarch64_simd_movv4hi}
     (nil))
```

which is a bogus transform as `v1` is still live and pointing to `cols_45_67`.

started somewhere between g:4096eb50d108a9ccef134f2e891c751b1cc9f6b2 and
g:29a1af24eface3620e348be9429e7c2e872accbc

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

* [Bug target/103094] [12 Regression] Incorrect codegen from AArch64 intrinsics
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
@ 2021-11-05  9:50 ` tnfchris at gcc dot gnu.org
  2021-11-05 12:18 ` tnfchris at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-11-05  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug target/103094] [12 Regression] Incorrect codegen from AArch64 intrinsics
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
  2021-11-05  9:50 ` [Bug target/103094] " tnfchris at gcc dot gnu.org
@ 2021-11-05 12:18 ` tnfchris at gcc dot gnu.org
  2021-11-05 12:22 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-11-05 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Looks like it's wrong from expand already, it's expanding into overlapping
registers.

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

* [Bug target/103094] [12 Regression] Incorrect codegen from AArch64 intrinsics
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
  2021-11-05  9:50 ` [Bug target/103094] " tnfchris at gcc dot gnu.org
  2021-11-05 12:18 ` tnfchris at gcc dot gnu.org
@ 2021-11-05 12:22 ` pinskia at gcc dot gnu.org
  2021-11-05 12:29 ` tnfchris at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-05 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=101529

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #1)
> Looks like it's wrong from expand already, it's expanding into overlapping
> registers.

Maybe a dup of bug 101529?

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

* [Bug target/103094] [12 Regression] Incorrect codegen from AArch64 intrinsics
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-11-05 12:22 ` pinskia at gcc dot gnu.org
@ 2021-11-05 12:29 ` tnfchris at gcc dot gnu.org
  2021-11-06  5:50 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-11-05 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Tamar Christina from comment #1)
> > Looks like it's wrong from expand already, it's expanding into overlapping
> > registers.
> 
> Maybe a dup of bug 101529?

hmm didn't know about that ticket, will have a look at stage 3, but this is
likely unrelated.  I think this is related to the new packed vector modes added
last night to handle the structure intrinsics (st[1,2,3,4] etc).

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

* [Bug target/103094] [12 Regression] Incorrect codegen from AArch64 intrinsics
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-11-05 12:29 ` tnfchris at gcc dot gnu.org
@ 2021-11-06  5:50 ` pinskia at gcc dot gnu.org
  2021-11-06 22:33 ` [Bug target/103094] [12 Regression] Incorrect codegen from uint8x8x2_t function arguments pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-06  5:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-06
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=101529    |
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What is wrong rather not understanding the incoming arguments is passed as q0
rather than d0/d1.

(insn 2 6 3 2 (set (reg/v:V2x8QI 101 [ cols_01_23 ])
        (reg:V2x8QI 32 v0 [ cols_01_23 ])) "t66.c":5:1 -1
     (nil))
(insn 3 2 4 2 (set (reg/v:V2x8QI 102 [ cols_45_67 ])
        (reg:V2x8QI 33 v1 [ cols_45_67 ])) "t66.c":5:1 -1
     (nil))

Caused by r12-4912-geb04ccf4bfd6586 .

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

* [Bug target/103094] [12 Regression] Incorrect codegen from uint8x8x2_t function arguments
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-11-06  5:50 ` pinskia at gcc dot gnu.org
@ 2021-11-06 22:33 ` pinskia at gcc dot gnu.org
  2021-12-13  9:12 ` [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect tnfchris at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-06 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression] Incorrect   |[12 Regression] Incorrect
                   |codegen from AArch64        |codegen from uint8x8x2_t
                   |intrinsics                  |function arguments
           Severity|normal                      |blocker

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

* [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect.
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-11-06 22:33 ` [Bug target/103094] [12 Regression] Incorrect codegen from uint8x8x2_t function arguments pinskia at gcc dot gnu.org
@ 2021-12-13  9:12 ` tnfchris at gcc dot gnu.org
  2021-12-15 12:19 ` cvs-commit at gcc dot gnu.org
  2021-12-15 12:24 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-12-13  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.wright at arm dot com
           Priority|P3                          |P1
            Summary|[12 Regression] Incorrect   |[12 Regression] AAPCS for
                   |codegen from uint8x8x2_t    |new partial vector mode
                   |function arguments          |types (e.g. V2x8QI) are
                   |                            |incorrect.
           Assignee|unassigned at gcc dot gnu.org      |tnfchris at gcc dot gnu.org

--- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
The frame layout and argument layout code for the new structs are incorrect, it
leads to the compiler thinking that every pair of values only use a single
register.

i.e. V2x8QI is 16 bytes long, so the compiler thinks the values are packed in a
single register.  This causes any code that returns or passes these new types
as function arguments to be incorrect.

Mine.

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

* [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect.
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-12-13  9:12 ` [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect tnfchris at gcc dot gnu.org
@ 2021-12-15 12:19 ` cvs-commit at gcc dot gnu.org
  2021-12-15 12:24 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-15 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:73c3dacef9a30d7d66918606a97c496c71289f1b

commit r12-5998-g73c3dacef9a30d7d66918606a97c496c71289f1b
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Dec 15 12:19:00 2021 +0000

    aarch64: Don't classify vector pairs as short vectors [PR103094]

    In this PR we were wrongly classifying a pair of 8-byte vectors
    as a 16-byte âshort vectorâ (in the AAPCS64 sense).  As the
    comment in the patch says, this stems from an old condition
    in aarch64_short_vector_p that is too loose, but that would
    be difficult to tighten now.

    We can still do the right thing for the newly-added modes though,
    since there are no backwards compatibility concerns there.

    Co-authored-by: Tamar Christina <tamar.christina@arm.com>

    gcc/
            PR target/103094
            * config/aarch64/aarch64.c (aarch64_short_vector_p): Return false
            for structure modes, rather than ignoring the type in that case.

    gcc/testsuite/
            PR target/103094
            * gcc.target/aarch64/pr103094.c: New test.

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

* [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect.
  2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-12-15 12:19 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15 12:24 ` rsandifo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-12-15 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-12-15 12:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  9:50 [Bug target/103094] New: [12 Regression] Incorrect codegen from AArch64 intrinsics tnfchris at gcc dot gnu.org
2021-11-05  9:50 ` [Bug target/103094] " tnfchris at gcc dot gnu.org
2021-11-05 12:18 ` tnfchris at gcc dot gnu.org
2021-11-05 12:22 ` pinskia at gcc dot gnu.org
2021-11-05 12:29 ` tnfchris at gcc dot gnu.org
2021-11-06  5:50 ` pinskia at gcc dot gnu.org
2021-11-06 22:33 ` [Bug target/103094] [12 Regression] Incorrect codegen from uint8x8x2_t function arguments pinskia at gcc dot gnu.org
2021-12-13  9:12 ` [Bug target/103094] [12 Regression] AAPCS for new partial vector mode types (e.g. V2x8QI) are incorrect tnfchris at gcc dot gnu.org
2021-12-15 12:19 ` cvs-commit at gcc dot gnu.org
2021-12-15 12:24 ` rsandifo 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).