https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108239

            Bug ID: 108239
           Summary: -mprefixed causes too large displacements for extended
                    inline asm memory operands
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npiggin at gmail dot com
                CC: segher at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc64le-linux-gnu

--- test.c ---
// powerpc64le-linux-gnu-gcc -O2 -mcpu=power10 -mno-pcrel -c test.c

#include <stdint.h>

static inline uint32_t readl(uint32_t *addr)
{
        uint32_t ret;
        __asm__ __volatile__("lwz %0,%1" : "=r" (ret) : "m" (*addr));
        return ret;
}

int test(void *addr)
{
        return readl(addr + 0x8024);
}
---

This generates invalid assembly 'lwz  3,32804(3)' with displacement exceeding
allowable size. Using -mno-prefixed fixes the problem.

Reply via email to