public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/47920] New: strange code generated for expression (a+7)/8
@ 2011-02-28  9:31 carrot at google dot com
  2011-02-28 10:48 ` [Bug target/47920] " mikpe at it dot uu.se
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: carrot at google dot com @ 2011-02-28  9:31 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-05 14:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-28  9:31 [Bug target/47920] New: strange code generated for expression (a+7)/8 carrot at google dot com
2011-02-28 10:48 ` [Bug target/47920] " mikpe at it dot uu.se
2011-02-28 10:51 ` jakub at gcc dot gnu.org
2011-03-01  6:44 ` carrot at google dot com
2011-03-03 10:50 ` ibolton at gcc dot gnu.org
2011-03-05 14:21 ` rearnsha 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).