public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields @ 2021-07-31 13:25 jengelh at inai dot de 2021-07-31 13:25 ` [Bug c/101705] " jengelh at inai dot de ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: jengelh at inai dot de @ 2021-07-31 13:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101705 Bug ID: 101705 Summary: Missed optimization opportunity when copying lots of bitfields Product: gcc Version: 11.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jengelh at inai dot de Target Milestone: --- Using gcc-11.1.1 [revision 62bbb113ae68a7e724255e17143520735bcb9ec9], I observe that gcc is able to recognize and combine lots of "structb->member = structa->member" assignments into SIMD instructions. However, this only works as long as "member" has exactly 8*n bits. It would appear gcc is not smart enough to consider smaller entities (if and when they add up to multiples of 8 or 64). Observed ======== [On x86_64] »gcc -O3 -c 1.c; gcc -O3 -c 2.c »objdump -d 1.o 0: f3 0f 6f 3e movdqu (%rsi),%xmm7 ... »objdump -d 2.o 0: 0f b6 16 movzbl (%rsi),%edx 3: 0f b6 07 movzbl (%rdi),%eax 6: 83 e2 01 and $0x1,%edx 9: 83 e0 fe and $0xfffffffe,%eax c: 09 d0 or %edx,%eax e: 88 07 mov %al,(%rdi) 10: 0f b6 16 movzbl (%rsi),%edx 13: 83 e0 fd and $0xfffffffd,%eax 16: 83 e2 02 and $0x2,%edx 19: 09 d0 or %edx,%eax 1b: 88 07 mov %al,(%rdi) ... Expected ======== Emit some movdqu/movups even for 2.c. Other info ========== gcc version 11.1.1 20210625 [revision 62bbb113ae68a7e724255e17143520735bcb9ec9] (SUSE Linux) & gcc version 7.5.0 (SUSE Linux) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101705] Missed optimization opportunity when copying lots of bitfields 2021-07-31 13:25 [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields jengelh at inai dot de @ 2021-07-31 13:25 ` jengelh at inai dot de 2021-07-31 13:25 ` jengelh at inai dot de ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: jengelh at inai dot de @ 2021-07-31 13:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101705 --- Comment #1 from Jan Engelhardt <jengelh at inai dot de> --- Created attachment 51228 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51228&action=edit testcase, 1.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101705] Missed optimization opportunity when copying lots of bitfields 2021-07-31 13:25 [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields jengelh at inai dot de 2021-07-31 13:25 ` [Bug c/101705] " jengelh at inai dot de @ 2021-07-31 13:25 ` jengelh at inai dot de 2021-07-31 19:35 ` [Bug tree-optimization/101705] " pinskia at gcc dot gnu.org 2021-08-02 8:38 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jengelh at inai dot de @ 2021-07-31 13:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101705 --- Comment #2 from Jan Engelhardt <jengelh at inai dot de> --- Created attachment 51229 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51229&action=edit testcase, 2.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/101705] Missed optimization opportunity when copying lots of bitfields 2021-07-31 13:25 [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields jengelh at inai dot de 2021-07-31 13:25 ` [Bug c/101705] " jengelh at inai dot de 2021-07-31 13:25 ` jengelh at inai dot de @ 2021-07-31 19:35 ` pinskia at gcc dot gnu.org 2021-08-02 8:38 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-07-31 19:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101705 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-31 Status|UNCONFIRMED |ASSIGNED Keywords| |missed-optimization Ever confirmed|0 |1 Component|c |tree-optimization Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Mine but for GCC 13. There are other bugs which say the same thing too. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/101705] Missed optimization opportunity when copying lots of bitfields 2021-07-31 13:25 [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields jengelh at inai dot de ` (2 preceding siblings ...) 2021-07-31 19:35 ` [Bug tree-optimization/101705] " pinskia at gcc dot gnu.org @ 2021-08-02 8:38 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-08-02 8:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101705 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |53947 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- SLP vectorization handles this and it even splits the groups and would use smaller groups for the tail but then it fails: t.i:244:10: note: === vect_slp_analyze_instance_alignment === t.i:244:10: missed: desired vector type conflicts with earlier one for _113 = s_129(D)->b113; t.i:244:10: note: removing SLP instance operations starting from: d_130(D)->b113 = _113; t.i:252:10: note: === vect_slp_analyze_instance_alignment === t.i:252:10: missed: desired vector type conflicts with earlier one for _121 = s_129(D)->b121; t.i:252:10: note: removing SLP instance operations starting from: d_130(D)->b121 = _121; t.i:256:10: note: === vect_slp_analyze_instance_alignment === t.i:256:10: missed: desired vector type conflicts with earlier one for _125 = s_129(D)->b125; t.i:256:10: note: removing SLP instance operations starting from: d_130(D)->b125 = _125; which is a pre-existing issue (and I think there's a duplicate for the vectorizer issue). Not sure what part Andrew wants to look at. Without vectorization we don't merge anything. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-02 8:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-07-31 13:25 [Bug c/101705] New: Missed optimization opportunity when copying lots of bitfields jengelh at inai dot de 2021-07-31 13:25 ` [Bug c/101705] " jengelh at inai dot de 2021-07-31 13:25 ` jengelh at inai dot de 2021-07-31 19:35 ` [Bug tree-optimization/101705] " pinskia at gcc dot gnu.org 2021-08-02 8:38 ` rguenth 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).