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

            Bug ID: 106895
           Summary: powerpc64 strange extended inline asm behaviour with
                    register pairs
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          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

This is Debian 12.2.0-1 build.

powerpc64 instructions operating on 128 bits use "even/odd pair" of adjacent
GPRs, where the lower numbered register specifies the pair and it must be an
even number. This code compiled with -O2:

void set128(__int128 val, __int128 *mem)
{
#if WORKAROUND
        asm("");
#endif
        asm("stq %1,%0" : "=m"(*mem) : "r"(val));
}

Results in an invalid even/odd pair:

        stq 3,0(5)
        blr

If compiled with -DWORKAROUND it results in a valid pair:

        mr 10,3
        mr 11,4
        stq 10,0(5)
        blr

Reply via email to