This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/47920] New: strange code generated for expression (a+7)/8
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Feb 2011 09:25:02 +0000
- Subject: [Bug target/47920] New: strange code generated for expression (a+7)/8
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47920
Summary: strange code generated for expression (a+7)/8
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: carrot@google.com
Target: arm-linux-androideabi
Compile the following code with options -mthumb -march=armv7-a -O2
int t08(int a)
{
return (a+7)/8;
}
GCC 4.6 generates
t08:
add r3, r0, #14
adds r0, r0, #7
it mi
movmi r0, r3
asrs r0, r0, #3
bx lr
Why not simply generate
adds r0, r0, #7
asrs r0, r0, #3
bx lr