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

            Bug ID: 115289
           Summary: PPC: Document the machine constraint 'Y' and make it
                    non-internal
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpe+gcc at ellerman dot id.au
  Target Milestone: ---

Please document the "Y" inline asm constraint for powerpc. It's needed to
correctly pass arbitrary pointer arguments to inline asm using a DS-form
instruction.

The Linux Kernel plans to use the constraint, see:

 
https://lore.kernel.org/linuxppc-dev/20240529123029.146953-1-...@ellerman.id.au/

A minimal reproducer for the problem seen in the kernel is below.

$ cat test.c
struct {
  long a;
  long b;
  short c;
  char d[8];
} e;

void f(void) {
  unsigned long v = 0;
  unsigned long *g = (unsigned long *)&e.d;
  asm goto("std%X0 %1,%0        # put_user\n" : "=m"(*g) : "r"(v) : : out);
out:
}

$ gcc-14 -Wall -nostdinc -O2 -c -o test.o test.c
/tmp/ccsSkWJz.s: Assembler messages:
/tmp/ccsSkWJz.s:21: Error: operand out of domain (18 is not a multiple of 4)

Reply via email to