public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15419] New: memcpy pessimization
@ 2004-05-14 1:27 falk at debian dot org
2004-05-14 2:00 ` [Bug tree-optimization/15419] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: falk at debian dot org @ 2004-05-14 1:27 UTC (permalink / raw)
To: gcc-bugs
gcc (GCC) 3.5.0 20040513 (experimental)
% cat test.c
typedef unsigned uint32_t;
uint32_t get_uint32(const void *p) {
uint32_t w;
memcpy(&w, p, sizeof (uint32_t));
return w;
}
uint32_t get_uint32a(const void *p) {
const struct { uint32_t w; } __attribute__((packed)) *wp = p;
return wp->w;
}
% gcc -c -O3 test.c && objdump -d test.o
0000000000000000 <get_uint32>:
0: 03 00 90 28 ldbu t3,3(a0)
4: 00 00 30 28 ldbu t0,0(a0)
8: f0 ff de 23 lda sp,-16(sp)
c: 01 00 50 28 ldbu t1,1(a0)
10: 02 00 70 28 ldbu t2,2(a0)
14: 00 00 3e 38 stb t0,0(sp)
18: 03 00 9e 38 stb t3,3(sp)
1c: 01 00 5e 38 stb t1,1(sp)
20: 02 00 7e 38 stb t2,2(sp)
24: 00 00 1e a0 ldl v0,0(sp)
28: 10 00 de 23 lda sp,16(sp)
2c: 01 80 fa 6b ret
0000000000000030 <get_uint32a>:
30: 00 00 50 2c ldq_u t1,0(a0)
34: 03 00 30 2c ldq_u t0,3(a0)
38: c2 04 50 48 extll t1,a0,t1
3c: 41 0d 30 48 extlh t0,a0,t0
40: 00 04 41 44 or t1,t0,v0
44: 00 00 e0 43 sextl v0,v0
48: 01 80 fa 6b ret
The code for get_uint32 is really bad compared to get_uint32a, but it is
an important portable idiom to achieve the same.
--
Summary: memcpy pessimization
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: falk at debian dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: alphaev68-unknown-linux-gnu
GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15419
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/15419] memcpy pessimization
2004-05-14 1:27 [Bug tree-optimization/15419] New: memcpy pessimization falk at debian dot org
@ 2004-05-14 2:00 ` pinskia at gcc dot gnu dot org
2005-05-18 7:37 ` rth at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-14 2:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-13 14:10 -------
Confirmed, I think RTH was going to something with memcpy.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-05-13 14:10:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15419
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/15419] memcpy pessimization
2004-05-14 1:27 [Bug tree-optimization/15419] New: memcpy pessimization falk at debian dot org
2004-05-14 2:00 ` [Bug tree-optimization/15419] " pinskia at gcc dot gnu dot org
@ 2005-05-18 7:37 ` rth at gcc dot gnu dot org
2005-05-18 8:21 ` rth at gcc dot gnu dot org
2005-08-05 20:40 ` rth at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-05-18 7:37 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2005-02-10 04:23:15 |2005-05-18 07:36:30
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15419
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/15419] memcpy pessimization
2004-05-14 1:27 [Bug tree-optimization/15419] New: memcpy pessimization falk at debian dot org
2004-05-14 2:00 ` [Bug tree-optimization/15419] " pinskia at gcc dot gnu dot org
2005-05-18 7:37 ` rth at gcc dot gnu dot org
@ 2005-05-18 8:21 ` rth at gcc dot gnu dot org
2005-08-05 20:40 ` rth at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-05-18 8:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2005-05-18 08:21 -------
Not alpha specific. The tunings we have in the alpha memcpy expansion are
correct for real copies between memory. We want to prefer
ldbu $1,3($17)
ldbu $2,0($17)
ldbu $3,1($17)
ldbu $4,2($17)
stb $1,3($16)
stb $2,0($16)
stb $3,1($16)
stb $4,2($16)
over
ldq_u $5,0($17)
ldq_u $2,3($17)
ldq_u $3,3($16)
ldq_u $4,0($16)
extlh $2,$17,$2
extll $5,$17,$5
msklh $3,$16,$3
mskll $4,$16,$4
bis $5,$2,$1
inslh $1,$16,$6
insll $1,$16,$1
bis $3,$6,$3
bis $4,$1,$4
stq_u $3,3($16)
stq_u $4,0($16)
The trick is that we want to notice at the tree level that the memcpy is
really a killing store of a local variable, and rewrite it into the
assignment form. I'll give it some thought.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet|alphaev68-*-linux-gnu |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15419
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/15419] memcpy pessimization
2004-05-14 1:27 [Bug tree-optimization/15419] New: memcpy pessimization falk at debian dot org
` (2 preceding siblings ...)
2005-05-18 8:21 ` rth at gcc dot gnu dot org
@ 2005-08-05 20:40 ` rth at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-08-05 20:40 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|rth at gcc dot gnu dot org |unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15419
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-08-05 20:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 1:27 [Bug tree-optimization/15419] New: memcpy pessimization falk at debian dot org
2004-05-14 2:00 ` [Bug tree-optimization/15419] " pinskia at gcc dot gnu dot org
2005-05-18 7:37 ` rth at gcc dot gnu dot org
2005-05-18 8:21 ` rth at gcc dot gnu dot org
2005-08-05 20:40 ` rth at gcc dot gnu dot 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).