public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
@ 2024-01-05  2:41 lehua.ding at rivai dot ai
  2024-01-05  2:50 ` [Bug target/113240] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lehua.ding at rivai dot ai @ 2024-01-05  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113240
           Summary: Use wrong rule to pass fixed-length(size<=2*XLEN)
                    vector argument
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lehua.ding at rivai dot ai
  Target Milestone: ---

According to a recent proposal
(https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/416), GCC
incorrectly uses references when passing fixed-length vector arguments with
size less than or equal to 2*VLEN instead of scalar registers for passing.
Reproduced online: https://godbolt.org/z/3ooovcz7c

C Code:
```
#include <stdint.h>

typedef int v4si __attribute__ ((vector_size (16)));

v4si foo (v4si a, v4si b)
{
  v4si c = a + b;
  return c;
}
```

Asm:
```
foo:
        vsetivli        zero,4,e32,m1,ta,ma
        vle32.v v1,0(a1)
        vle32.v v2,0(a2)
        vadd.vv v1,v1,v2
        vse32.v v1,0(a0)
        ret
```

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
@ 2024-01-05  2:50 ` pinskia at gcc dot gnu.org
  2024-01-05  3:14 ` lehua.ding at rivai dot ai
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-05  2:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There needs to be a -Wabi warning for this too for the change between versions.

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
  2024-01-05  2:50 ` [Bug target/113240] " pinskia at gcc dot gnu.org
@ 2024-01-05  3:14 ` lehua.ding at rivai dot ai
  2024-01-05  3:39 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lehua.ding at rivai dot ai @ 2024-01-05  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Lehua Ding <lehua.ding at rivai dot ai> ---
(In reply to Andrew Pinski from comment #1)
> There needs to be a -Wabi warning for this too for the change between
> versions.

I'm more inclined to think of it as a bug, since the vector ABI specification
is still being worked out and isn't stable and currently used with vector
arguments will throw a warning about unstable.

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
  2024-01-05  2:50 ` [Bug target/113240] " pinskia at gcc dot gnu.org
  2024-01-05  3:14 ` lehua.ding at rivai dot ai
@ 2024-01-05  3:39 ` pinskia at gcc dot gnu.org
  2024-01-05  3:49 ` lehua.ding at rivai dot ai
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-05  3:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Lehua Ding from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > There needs to be a -Wabi warning for this too for the change between
> > versions.
> 
> I'm more inclined to think of it as a bug, since the vector ABI
> specification is still being worked out and isn't stable and currently used
> with vector arguments will throw a warning about unstable.

Yes but other targets had bugs in argument passing and now throw a warning
about the change ... Plus there is no current -Wpsabi warning in previous
versions of GCC ....

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
                   ` (2 preceding siblings ...)
  2024-01-05  3:39 ` pinskia at gcc dot gnu.org
@ 2024-01-05  3:49 ` lehua.ding at rivai dot ai
  2024-01-05  4:38 ` pinskia at gcc dot gnu.org
  2024-01-05  7:05 ` kito at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: lehua.ding at rivai dot ai @ 2024-01-05  3:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Lehua Ding <lehua.ding at rivai dot ai> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Lehua Ding from comment #2)
> > (In reply to Andrew Pinski from comment #1)
> > > There needs to be a -Wabi warning for this too for the change between
> > > versions.
> > 
> > I'm more inclined to think of it as a bug, since the vector ABI
> > specification is still being worked out and isn't stable and currently used
> > with vector arguments will throw a warning about unstable.
> 
> Yes but other targets had bugs in argument passing and now throw a warning
> about the change ... Plus there is no current -Wpsabi warning in previous
> versions of GCC ....

OK, makes sense.

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
                   ` (3 preceding siblings ...)
  2024-01-05  3:49 ` lehua.ding at rivai dot ai
@ 2024-01-05  4:38 ` pinskia at gcc dot gnu.org
  2024-01-05  7:05 ` kito at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-05  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-05
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

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

* [Bug target/113240] Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument
  2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
                   ` (4 preceding siblings ...)
  2024-01-05  4:38 ` pinskia at gcc dot gnu.org
@ 2024-01-05  7:05 ` kito at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: kito at gcc dot gnu.org @ 2024-01-05  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Kito Cheng <kito at gcc dot gnu.org> ---
> There needs to be a -Wabi warning for this too for the change between versions.

This bug only happened on trunk, and GCC 13 is OK, so I think it's not the
case?

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

end of thread, other threads:[~2024-01-05  7:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05  2:41 [Bug target/113240] New: Use wrong rule to pass fixed-length(size<=2*XLEN) vector argument lehua.ding at rivai dot ai
2024-01-05  2:50 ` [Bug target/113240] " pinskia at gcc dot gnu.org
2024-01-05  3:14 ` lehua.ding at rivai dot ai
2024-01-05  3:39 ` pinskia at gcc dot gnu.org
2024-01-05  3:49 ` lehua.ding at rivai dot ai
2024-01-05  4:38 ` pinskia at gcc dot gnu.org
2024-01-05  7:05 ` kito 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).