public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66364] New: poor optimization of packed structs containing bitfields
@ 2015-06-01 15:35 rogero at howzatt dot demon.co.uk
  2020-05-11  5:32 ` [Bug middle-end/66364] " egallager at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rogero at howzatt dot demon.co.uk @ 2015-06-01 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66364
           Summary: poor optimization of packed structs containing
                    bitfields
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rogero at howzatt dot demon.co.uk
  Target Milestone: ---
            Target: x86_64-redhat-linux

Created attachment 35667
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35667&action=edit
Simple program demonstrating the issue

Code accessing bitfields in packed structures seem to load the value a byte at
a time and build the value up using shifts and ors even with -O3.

On x64 it could load the value using a single mov instruction as it does when
the struct is not packed or when the field is not a bitfield.


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

* [Bug middle-end/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
@ 2020-05-11  5:32 ` egallager at gcc dot gnu.org
  2021-08-11  0:31 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-05-11  5:32 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
there are some other bugs open that are similar to this; I am tired though so
I'll pull their numbers back up later...

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

* [Bug middle-end/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
  2020-05-11  5:32 ` [Bug middle-end/66364] " egallager at gcc dot gnu.org
@ 2021-08-11  0:31 ` pinskia at gcc dot gnu.org
  2023-02-25  6:44 ` [Bug tree-optimization/66364] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11  0:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Severity|normal                      |enhancement
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-11
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine for GCC 13.

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

* [Bug tree-optimization/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
  2020-05-11  5:32 ` [Bug middle-end/66364] " egallager at gcc dot gnu.org
  2021-08-11  0:31 ` pinskia at gcc dot gnu.org
@ 2023-02-25  6:44 ` pinskia at gcc dot gnu.org
  2023-02-26  1:34 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-25  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 55658.

*** This bug has been marked as a duplicate of bug 55658 ***

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

* [Bug tree-optimization/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
                   ` (2 preceding siblings ...)
  2023-02-25  6:44 ` [Bug tree-optimization/66364] " pinskia at gcc dot gnu.org
@ 2023-02-26  1:34 ` pinskia at gcc dot gnu.org
  2023-02-26  2:19 ` pinskia at gcc dot gnu.org
  2024-03-08 22:12 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-26  1:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|DUPLICATE                   |---
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=55658

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So in the end this is not an exact dup of bug 55658 as the patch I did does not
change the code here but does fix PR 55658 .

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

* [Bug tree-optimization/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
                   ` (3 preceding siblings ...)
  2023-02-26  1:34 ` pinskia at gcc dot gnu.org
@ 2023-02-26  2:19 ` pinskia at gcc dot gnu.org
  2024-03-08 22:12 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-26  2:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The reason why the patch for PR 55658 didn't have any effect here is because by
the time get_best_mode is called, bitregion_start and bitregion_end are set to
0 because they don't get passed down.

So if we do lowering of the bitfield early on, then we should be able to get
the correct behavior ...
Double checking that.

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

* [Bug tree-optimization/66364] poor optimization of packed structs containing bitfields
  2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
                   ` (4 preceding siblings ...)
  2023-02-26  2:19 ` pinskia at gcc dot gnu.org
@ 2024-03-08 22:12 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-08 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dan at stahlke dot org

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 114289 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2024-03-08 22:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 15:35 [Bug c++/66364] New: poor optimization of packed structs containing bitfields rogero at howzatt dot demon.co.uk
2020-05-11  5:32 ` [Bug middle-end/66364] " egallager at gcc dot gnu.org
2021-08-11  0:31 ` pinskia at gcc dot gnu.org
2023-02-25  6:44 ` [Bug tree-optimization/66364] " pinskia at gcc dot gnu.org
2023-02-26  1:34 ` pinskia at gcc dot gnu.org
2023-02-26  2:19 ` pinskia at gcc dot gnu.org
2024-03-08 22:12 ` 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).