public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113857] New: fmov should be used to zero the upper bits of the vector register
@ 2024-02-09 23:37 pinskia at gcc dot gnu.org
  2024-02-09 23:41 ` [Bug target/113857] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-09 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113857
           Summary: fmov should be used to zero the upper bits of the
                    vector register
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Take:
```
#define vect128 __attribute__((vector_size(16) ))
#define vect64 __attribute__((vector_size(8) ))

vect64  float f64( float a)
{
  return (vect64 float){a, 0};
}

vect128  float f128( float a)
{
  return (vect128 float){a, 0, 0, 0};
}
```

GCC produces fmov for f64 but does not for f128.


Note we could the same for:
```
vect64  short s64( short a)
{
  return (vect64 short){a, 0};
}

vect128  int i128( int a)
{
  return (vect128 int){a, 0};
}
```

Well s64 can only be done if f16 extensions are enabled.

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

* [Bug target/113857] fmov should be used to zero the upper bits of the vector register
  2024-02-09 23:37 [Bug target/113857] New: fmov should be used to zero the upper bits of the vector register pinskia at gcc dot gnu.org
@ 2024-02-09 23:41 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-09 23:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Without f16 extension, s64 could be done as:
```
and x0, x0, 0xffff
fmov s0, x0
```

Similarly if we are doing a `c64` .

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

end of thread, other threads:[~2024-02-09 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 23:37 [Bug target/113857] New: fmov should be used to zero the upper bits of the vector register pinskia at gcc dot gnu.org
2024-02-09 23:41 ` [Bug target/113857] " pinskia 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).