public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39549] New: Nonoptimal byte load. mov (%rdi),%al better then movzbl (%rdi),%eax
@ 2009-03-24 18:59 vvv at ru dot ru
2009-04-22 23:33 ` [Bug target/39549] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 3+ messages in thread
From: vvv at ru dot ru @ 2009-03-24 18:59 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]
> gcc --version
gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]
> cat test.c
// file test.c One byte transfer
void f(char *a,char *b){
*b=*a;
}
void F(char *a,char *b){
asm volatile("mov (%rdi),%al\nmov %al,(%rsi)");
}
...
> gcc -g -otest test.c -O2 -mtune=core2
> objdump -d test
....
00000000004004f0 <f>:
4004f0: 0f b6 07 movzbl (%rdi),%eax
4004f3: 88 06 mov %al,(%rsi)
4004f5: c3 retq
4004f6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
4004fd: 00 00 00
0000000000400500 <F>:
400500: 8a 07 mov (%rdi),%al
400502: 88 06 mov %al,(%rsi)
400504: c3 retq
GCC use movzbl (%rdi),%eax, but better to use mov (%rdi),%al, because last
instruction 1 byte shorter. Execution time the same (at least on Core 2 Duo and
Core 2 Solo).
Probably it is result of Intel recomendations to use movz to avoid a partial
register stall. But smaller instruction reduce fetch bandwidth... and
Qwote from: Intel® 64 and IA-32 Architectures Optimization Reference Manual
248966. 3.5.2.3 Partial Register Stalls
"The delay of a partial register stall is small in processors based on Intel
Core and
NetBurst microarchitectures, and in Pentium M processor (with CPUID signature
family 6, model 13), Intel Core Solo, and Intel Core Duo processors. Pentium M
processors (CPUID signature with family 6, model 9) and the P6 family incur a
large
penalty."
--
Summary: Nonoptimal byte load. mov (%rdi),%al better then movzbl
(%rdi),%eax
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vvv at ru dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39549
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/39549] Nonoptimal byte load. mov (%rdi),%al better then movzbl (%rdi),%eax
2009-03-24 18:59 [Bug c/39549] New: Nonoptimal byte load. mov (%rdi),%al better then movzbl (%rdi),%eax vvv at ru dot ru
@ 2009-04-22 23:33 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 23:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-22 23:32 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-04-22 23:32:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39549
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/39549] Nonoptimal byte load. mov (%rdi),%al better then movzbl (%rdi),%eax
[not found] <bug-39549-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-09 22:26 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-09 22:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39549
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |missed-optimization
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-09 22:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-24 18:59 [Bug c/39549] New: Nonoptimal byte load. mov (%rdi),%al better then movzbl (%rdi),%eax vvv at ru dot ru
2009-04-22 23:33 ` [Bug target/39549] " pinskia at gcc dot gnu dot org
[not found] <bug-39549-4@http.gcc.gnu.org/bugzilla/>
2021-09-09 22:26 ` 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).