http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45804

           Summary: ARM: unnecessary sign extension
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: felipe.contre...@gmail.com


In the following code gcc add an unnecessary uxth operation.

static inline uint16_t read16_be(const uint8_t *p)
{
    uint16_t v;
    __asm__("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
    __asm__("rev16 %0, %0" : "+r"(v));
    return v;
}

Many other people have experienced this issue:
http://article.gmane.org/gmane.comp.video.ffmpeg.cvs/33470
http://article.gmane.org/gmane.comp.video.ffmpeg.devel/106781
https://bugs.launchpad.net/gcc-linaro/+bug/634682

Reply via email to