public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/23684] New: Combine stores for non strict alignment targets
@ 2005-09-01 18:05 pinskia at gcc dot gnu dot org
2005-09-01 18:07 ` [Bug rtl-optimization/23684] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-01 18:05 UTC (permalink / raw)
To: gcc-bugs
Take the following code:
#define OSSwapHostToBigInt32
void foo(char *input) {
input[0] = 'H';
input[1] = 'e';
input[2] = 'l';
input[3] = 'l';
input[4] = 'o';
input[5] = ' ';
input[6] = 'w';
input[7] = 'o';
input[8] = 'r';
input[9] = 'l';
input[10] = 'd';
input[11] = '\0';
}
void bar(char *input) {
((unsigned int *)input)[0] = OSSwapHostToBigInt32('Hell');
((unsigned int *)input)[1] = OSSwapHostToBigInt32('o wo');
((unsigned int *)input)[2] = OSSwapHostToBigInt32('rld\0');
}
They should generate the same asm but currently don't. Note change OSSwapHostToBigInt32 to correct
for little endian.
--
Summary: Combine stores for non strict alignment targets
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
2005-09-01 18:05 [Bug rtl-optimization/23684] New: Combine stores for non strict alignment targets pinskia at gcc dot gnu dot org
@ 2005-09-01 18:07 ` pinskia at gcc dot gnu dot org
2005-09-07 1:42 ` amodra at bigpond dot net dot au
2005-09-15 20:15 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-01 18:07 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet| |powerpc-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
2005-09-01 18:05 [Bug rtl-optimization/23684] New: Combine stores for non strict alignment targets pinskia at gcc dot gnu dot org
2005-09-01 18:07 ` [Bug rtl-optimization/23684] " pinskia at gcc dot gnu dot org
@ 2005-09-07 1:42 ` amodra at bigpond dot net dot au
2005-09-15 20:15 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 15+ messages in thread
From: amodra at bigpond dot net dot au @ 2005-09-07 1:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amodra at bigpond dot net dot au 2005-09-07 01:42 -------
Also even when -mstrict-align if using
typedef char align_char __attribute__ ((aligned (4)));
void foo (align_char *input) ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
2005-09-01 18:05 [Bug rtl-optimization/23684] New: Combine stores for non strict alignment targets pinskia at gcc dot gnu dot org
2005-09-01 18:07 ` [Bug rtl-optimization/23684] " pinskia at gcc dot gnu dot org
2005-09-07 1:42 ` amodra at bigpond dot net dot au
@ 2005-09-15 20:15 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-15 20:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-15 20:14 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-09-15 20:14:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2013-05-18 14:04 ` msharov at users dot sourceforge.net
@ 2013-11-10 6:30 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-10 6:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |justin at fathomdb dot com
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 50246 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-05-17 9:52 ` jakub at gcc dot gnu.org
@ 2013-05-18 14:04 ` msharov at users dot sourceforge.net
2013-11-10 6:30 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 15+ messages in thread
From: msharov at users dot sourceforge.net @ 2013-05-18 14:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
--- Comment #12 from msharov at users dot sourceforge.net ---
I'd like to add that this is not some corner case; this is a very common issue.
In my own projects, the compiler's inability to combine stores is the single
largest reason for using inline assembly and raw casts. Pretty much every time
I have an object 8 or 16 bytes in size, I end up writing a zeroing ctor, copy
ctor, and operator= that use full-object memory access. That's cast to uint64_t
for 8 bytes, and movups/movaps for 16 bytes. It also shows up when writing raw
protocol data, such as X calls, where it is very common to write several
constants in succession. The last time I checked, forcing whole-object moves in
these cases results in projectwide code size reduction ~10%. Unfortunately, it
also causes a variety of aliasing pessimizations, so I also have to test
including or not including each of the above functions to get the smallest code
size. I would be a very big deal if the optimizer could do this.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
2012-07-18 9:36 ` rguenth at gcc dot gnu.org
2013-05-17 8:48 ` rguenth at gcc dot gnu.org
@ 2013-05-17 9:52 ` jakub at gcc dot gnu.org
2013-05-18 14:04 ` msharov at users dot sourceforge.net
2013-11-10 6:30 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-17 9:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is related to PR22141 . But it caused performance regressions on ppc,
which is why it hasn't been installed. If there are ideas how to tune that, I
can try to ressurrect the patch.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
2012-07-18 9:36 ` rguenth at gcc dot gnu.org
@ 2013-05-17 8:48 ` rguenth at gcc dot gnu.org
2013-05-17 9:52 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-17 8:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msharov at users dot sourceforge.n
| |et
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 57302 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
@ 2012-07-18 9:36 ` rguenth at gcc dot gnu.org
2013-05-17 8:48 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-18 9:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |plasmahh at gmx dot net
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-18 09:35:42 UTC ---
*** Bug 54011 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2007-04-03 16:53 ` pinskia at gcc dot gnu dot org
@ 2007-04-03 16:54 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-03 16:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2007-04-03 17:54 -------
*** Bug 19726 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yuri at tsoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2006-11-29 5:11 ` acahalan at gmail dot com
@ 2007-04-03 16:53 ` pinskia at gcc dot gnu dot org
2007-04-03 16:54 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-03 16:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2007-04-03 17:53 -------
*** Bug 14613 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cesarb at cesarb dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-11-29 5:05 ` pinskia at gcc dot gnu dot org
@ 2006-11-29 5:11 ` acahalan at gmail dot com
2007-04-03 16:53 ` pinskia at gcc dot gnu dot org
2007-04-03 16:54 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 15+ messages in thread
From: acahalan at gmail dot com @ 2006-11-29 5:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from acahalan at gmail dot com 2006-11-29 05:11 -------
This hits it too. (example is PowerPC)
///////////////////
#include <string.h>
char *foo(char *buf)
{
short temp;
int temp1;
*buf++=42;
temp = 0xfeed;
memcpy(buf, &temp, sizeof(temp));
buf+=sizeof(temp);
temp1 = 0x12345678;
memcpy(buf, &temp1, sizeof(temp1));
buf+=sizeof(temp1);
temp1 = 0x12345678;
memcpy(buf, &temp1, sizeof(temp1));
buf+=sizeof(temp1);
*buf++=42;
return buf;
}
///////////////
foo:
stwu 1,-32(1)
lis 9,0x1234
li 11,42
li 0,-275
ori 9,9,22136
stb 11,11(3)
stb 11,0(3)
sth 0,1(3)
stw 9,7(3)
stw 9,3(3)
addi 3,3,12
addi 1,1,32
blr
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
2006-09-21 4:39 ` pinskia at gcc dot gnu dot org
2006-09-21 5:12 ` acahalan at gmail dot com
@ 2006-11-29 5:05 ` pinskia at gcc dot gnu dot org
2006-11-29 5:11 ` acahalan at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-29 5:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-11-29 05:05 -------
(In reply to comment #4)
> Target powerpc-*-* is wrong. See bug 29158 (my dupe) for the i386 assembly
> produced by a slightly more recent compiler. It's x86_64 too.
I just used the target as powerpc as I was also showing asm code.
> It's not just (char*) either. It's (short*) and even struct members.
The problems are all the same, really.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
2006-09-21 4:39 ` pinskia at gcc dot gnu dot org
@ 2006-09-21 5:12 ` acahalan at gmail dot com
2006-11-29 5:05 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: acahalan at gmail dot com @ 2006-09-21 5:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from acahalan at gmail dot com 2006-09-21 05:12 -------
Target powerpc-*-* is wrong. See bug 29158 (my dupe) for the i386 assembly
produced by a slightly more recent compiler. It's x86_64 too.
It's not just (char*) either. It's (short*) and even struct members.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/23684] Combine stores for non strict alignment targets
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
@ 2006-09-21 4:39 ` pinskia at gcc dot gnu dot org
2006-09-21 5:12 ` acahalan at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-21 4:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-09-21 04:39 -------
*** Bug 29158 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |acahalan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23684
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-11-10 6:30 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-01 18:05 [Bug rtl-optimization/23684] New: Combine stores for non strict alignment targets pinskia at gcc dot gnu dot org
2005-09-01 18:07 ` [Bug rtl-optimization/23684] " pinskia at gcc dot gnu dot org
2005-09-07 1:42 ` amodra at bigpond dot net dot au
2005-09-15 20:15 ` pinskia at gcc dot gnu dot org
[not found] <bug-23684-6528@http.gcc.gnu.org/bugzilla/>
2006-09-21 4:39 ` pinskia at gcc dot gnu dot org
2006-09-21 5:12 ` acahalan at gmail dot com
2006-11-29 5:05 ` pinskia at gcc dot gnu dot org
2006-11-29 5:11 ` acahalan at gmail dot com
2007-04-03 16:53 ` pinskia at gcc dot gnu dot org
2007-04-03 16:54 ` pinskia at gcc dot gnu dot org
[not found] <bug-23684-4@http.gcc.gnu.org/bugzilla/>
2012-07-18 9:36 ` rguenth at gcc dot gnu.org
2013-05-17 8:48 ` rguenth at gcc dot gnu.org
2013-05-17 9:52 ` jakub at gcc dot gnu.org
2013-05-18 14:04 ` msharov at users dot sourceforge.net
2013-11-10 6:30 ` 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).