public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
@ 2012-05-31  4:30 hp at gcc dot gnu.org
  2012-05-31  4:32 ` [Bug middle-end/53535] " hp at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-31  4:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

             Bug #: 53535
           Summary: non-aligned memset on non-strict-alignment targets not
                    optimized where aligned memset is
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hp@gcc.gnu.org
            Target: x86_64-linux


The attached code is a modified gcc.dg/pr46647.c, which shows that memset isn't
optimized on unaligned short (int-sized) data as it is for aligned data, even
for non-strict-alignment targets, such as cris-* and x86_64-linux. Observe the
emitted assembly code, which uses the same instructions for aligned and
unaligned code as later optimizations cover up (for both cris-* and
x86_64-linux). Hence, I guess this bug isn't really that important when it
comes to just the generated code, just an annoying middle-end miss and
annoyingly failing test-case.  (Whether the over-alignment-checks misses other
optimization opportunities is another issue.)

Background: I stumbled upon this when changing the CRIS port to align global
data by default. This made the always-before-failing gcc.dg/pr46647.c pass, for
no good reason: alignment of data should not make a difference for emitted code
(except for atomic support, WIP for CRIS).

This may be related to PR 52861.


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
@ 2012-05-31  4:32 ` hp at gcc dot gnu.org
  2012-05-31  4:37 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-31  4:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

--- Comment #1 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-05-31 04:30:08 UTC ---
Created attachment 27528
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27528
Modified gcc.dg/pr46647.c


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
  2012-05-31  4:32 ` [Bug middle-end/53535] " hp at gcc dot gnu.org
@ 2012-05-31  4:37 ` pinskia at gcc dot gnu.org
  2012-05-31  4:40 ` hp at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-31  4:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-31 04:32:00 UTC ---
>alignment of data should not make a difference for emitted code

Unless the loading of unalignment makes it much slower.  I thinking where two
aligned half loads are better than one unaligned word load.  I think there are
targets like that.


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
  2012-05-31  4:32 ` [Bug middle-end/53535] " hp at gcc dot gnu.org
  2012-05-31  4:37 ` pinskia at gcc dot gnu.org
@ 2012-05-31  4:40 ` hp at gcc dot gnu.org
  2012-05-31  4:43 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment !SLOW_UNALIGNED_ACCESS " hp at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-31  4:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

--- Comment #3 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-05-31 04:37:37 UTC ---
(In reply to comment #0)
> Observe the
> emitted assembly code, which uses the same instructions for aligned and
> unaligned code

...(compare with the code from gcc.dg/pr46647.c here)...

SVN revision 188039.


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment !SLOW_UNALIGNED_ACCESS targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-05-31  4:40 ` hp at gcc dot gnu.org
@ 2012-05-31  4:43 ` hp at gcc dot gnu.org
  2012-05-31  7:09 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment " hp at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-31  4:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|non-aligned memset on       |non-aligned memset on
                   |non-strict-alignment        |non-strict-alignment
                   |targets not optimized where |!SLOW_UNALIGNED_ACCESS
                   |aligned memset is           |targets not optimized where
                   |                            |aligned memset is

--- Comment #4 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-05-31 04:40:12 UTC ---
(In reply to comment #2)
> Unless the loading of unalignment makes it much slower.

Well, yes, I missed adding !SLOW_UNALIGNED_ACCESS in the title. :)


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-05-31  4:43 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment !SLOW_UNALIGNED_ACCESS " hp at gcc dot gnu.org
@ 2012-05-31  7:09 ` hp at gcc dot gnu.org
  2012-06-07 20:44 ` hp at gcc dot gnu.org
  2022-05-21 18:35 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-31  7:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|non-aligned memset on       |non-aligned memset on
                   |non-strict-alignment        |non-strict-alignment
                   |!SLOW_UNALIGNED_ACCESS      |targets not optimized where
                   |targets not optimized where |aligned memset is
                   |aligned memset is           |

--- Comment #5 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-05-31 04:43:12 UTC ---
(In reply to comment #4)
> Well, yes, I missed adding !SLOW_UNALIGNED_ACCESS in the title. :)

Never mind, SLOW_UNALIGNED_ACCESS != 0 is much more severe than the cost of
single insns.  Bah.  Maybe this is an issue of missing cost metric.


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-05-31  7:09 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment " hp at gcc dot gnu.org
@ 2012-06-07 20:44 ` hp at gcc dot gnu.org
  2022-05-21 18:35 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: hp at gcc dot gnu.org @ 2012-06-07 20:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53535

--- Comment #6 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-06-07 20:44:06 UTC ---
Author: hp
Date: Thu Jun  7 20:44:01 2012
New Revision: 188317

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188317
Log:
    PR middle-end/53535
    * gcc.dg/pr46647.c: xfail for cris-* and crisv32-*.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr46647.c


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

* [Bug middle-end/53535] non-aligned memset on non-strict-alignment targets not optimized where aligned memset is
  2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-06-07 20:44 ` hp at gcc dot gnu.org
@ 2022-05-21 18:35 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-21 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Dimitar Dimitrov <dimitar@gcc.gnu.org>:

https://gcc.gnu.org/g:0380b6575f61e5bd9f428887790716a57dd66488

commit r13-698-g0380b6575f61e5bd9f428887790716a57dd66488
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date:   Sun May 15 17:11:39 2022 +0300

    testsuite: Skip gcc.dg/pr46647.c for PRU

    Like AVR and Cris, PRU has no alignment requirements.  Thus it is
    also affected by PR53535.

            PR middle-end/53535

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr46647.c: Skip for pru target.

    Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

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

end of thread, other threads:[~2022-05-21 18:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-31  4:30 [Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is hp at gcc dot gnu.org
2012-05-31  4:32 ` [Bug middle-end/53535] " hp at gcc dot gnu.org
2012-05-31  4:37 ` pinskia at gcc dot gnu.org
2012-05-31  4:40 ` hp at gcc dot gnu.org
2012-05-31  4:43 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment !SLOW_UNALIGNED_ACCESS " hp at gcc dot gnu.org
2012-05-31  7:09 ` [Bug middle-end/53535] non-aligned memset on non-strict-alignment " hp at gcc dot gnu.org
2012-06-07 20:44 ` hp at gcc dot gnu.org
2022-05-21 18:35 ` cvs-commit 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).