public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f`
@ 2024-02-09 23:30 pinskia at gcc dot gnu.org
  2024-02-09 23:37 ` [Bug target/113856] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-09 23:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113856
           Summary: `(vect64 float){1.0f, 0}` code generation could just
                    be `fmov sN, 1.0f`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

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

vect64  float f1( float a)
{
  return (vect64 float){1.0f, 0};
}
vect64  float f2( float a)
{
  return (vect64 float){1.0f, 1.0f};
}
```

Currently GCC produces:
```
f1:
        adrp    x0, .LC0
        ldr     d0, [x0, #:lo12:.LC0]
        ret
f2:
        fmov    v0.2s, 1.0e+0
        ret
```


But f1 could be implemented using fmov also.
Like:
```
f1:
        fmov    s0, 1.0e+0
        ret
```

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

* [Bug target/113856] `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f`
  2024-02-09 23:30 [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f` pinskia at gcc dot gnu.org
@ 2024-02-09 23:37 ` pinskia at gcc dot gnu.org
  2024-02-15  4:41 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ 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=113856

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug target/113856] `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f`
  2024-02-09 23:30 [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f` pinskia at gcc dot gnu.org
  2024-02-09 23:37 ` [Bug target/113856] " pinskia at gcc dot gnu.org
@ 2024-02-15  4:41 ` pinskia at gcc dot gnu.org
  2024-02-15  6:38 ` pinskia at gcc dot gnu.org
  2024-02-15  8:25 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-15  4:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-02-15

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have a patch.

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

* [Bug target/113856] `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f`
  2024-02-09 23:30 [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f` pinskia at gcc dot gnu.org
  2024-02-09 23:37 ` [Bug target/113856] " pinskia at gcc dot gnu.org
  2024-02-15  4:41 ` pinskia at gcc dot gnu.org
@ 2024-02-15  6:38 ` pinskia at gcc dot gnu.org
  2024-02-15  8:25 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-15  6:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note for:
```
#define vect128 __attribute__((vector_size(16) ))

vect128  float f1()
{
  return (vect64 float){1.0f, 1.0f, 0.0f, 0.0f};
}
```

Should also be able to do:
```
fmov v0.2s, 1.0
```

The instruction here does zero the upper parts of the register too.
I have a patch for that too.

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

* [Bug target/113856] `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f`
  2024-02-09 23:30 [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f` pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-15  6:38 ` pinskia at gcc dot gnu.org
@ 2024-02-15  8:25 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-15  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I should note that the one place where `{1.0, 0.0}` shows up is the use with
complex :). I found it on accident while understanding why I was getting a
failure with `libgomp.c-c++-common/reduction-*.c` where I would also match on
accident `{1.0, 0.0, 1.0, 0.0}`.

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

end of thread, other threads:[~2024-02-15  8:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 23:30 [Bug target/113856] New: `(vect64 float){1.0f, 0}` code generation could just be `fmov sN, 1.0f` pinskia at gcc dot gnu.org
2024-02-09 23:37 ` [Bug target/113856] " pinskia at gcc dot gnu.org
2024-02-15  4:41 ` pinskia at gcc dot gnu.org
2024-02-15  6:38 ` pinskia at gcc dot gnu.org
2024-02-15  8:25 ` 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).