This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15533] New: Missed move to partial register
- From: "cesarb at nitnet dot com dot br" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2004 01:25:31 -0000
- Subject: [Bug tree-optimization/15533] New: Missed move to partial register
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When compiling:
#include <stdint.h>
#define regparm __attribute__((regparm(3)))
uint8_t a;
uint16_t regparm fn(uint16_t b)
{ return (b & ~0xFF) | a; }
With:
gcc -W -Wall -O3 -ffast-math -fomit-frame-pointer -fexpensive-optimizations
-save-temps -march=athlon -c
The result is:
.file "testcase.c"
.text
.align 4
.p2align 4,,15
.globl fn
.type fn, @function
fn:
movzbw a, %dx
xorb %al, %al
orl %edx, %eax
movzwl %ax, %eax
ret
.size fn, .-fn
.comm a,1,1
.ident "GCC: (GNU) 3.5.0 20040502 (experimental)"
.section .note.GNU-stack,"",@progbits
The expected result would be:
fn:
movb a, %al
ret
(I assume the correct ABI for regparm would be for the caller to do all the
sign/zero extension work, since it could be done as side effects of calculations
there, so there is no need to do any extension inside fn. If I'm wrong, just add
an extra movzwl %ax, %eax somewhere)
Reading specs from /usr/lib/gcc-snapshot/lib/gcc/i486-linux/3.5.0/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,objc,ada,treelang
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls
--enable-threads=posix --without-included-gettext --disable-werror
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk i486-linux
Thread model: posix
gcc version 3.5.0 20040502 (experimental)
--
Summary: Missed move to partial register
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cesarb at nitnet dot com dot br
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15533