This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22072] bizarre code for int*int/2
- From: "felix-gcc at fefe dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jun 2005 06:12:38 -0000
- Subject: [Bug c/22072] bizarre code for int*int/2
- References: <20050615060438.22072.felix-gcc@fefe.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From felix-gcc at fefe dot de 2005-06-15 06:12 -------
by the way, -Os generates an unnecessary register move:
pushl %ebp
movl $2, %edx
movl %esp, %ebp
movl 12(%ebp), %eax
movl %edx, %ecx
imull 8(%ebp), %eax
popl %ebp
cltd
idivl %ecx
ret
gcc should put the $2 directly in %ecx here. Or it should note that "mov
$2,%ecx; idiv %ecx" is 7 bytes, while "sar %eax" is only two bytes, and emit the
latter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22072