[Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel

acsawdey at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 16 15:48:10 GMT 2020


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

            Bug ID: 94622
           Summary: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on
                    powerpc64le with -mpcrel
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acsawdey at gcc dot gnu.org
  Target Milestone: ---

Compile command:
/home2/sawdey/work/gcc/mamboCI/build-mambo/gcc/xgcc
-B/home2/sawdey/work/gcc/mamboCI/build-mambo/gcc/
/home2/sawdey/work/gcc/mamboCI/pike-trunk/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-1.c
-B/home2/sawdey/work/gcc/mamboCI/build-mambo/powerpc64le-unknown-linux-gnu/./libatomic/
-L/home2/sawdey/work/gcc/mamboCI/build-mambo/powerpc64le-unknown-linux-gnu/./libatomic/.libs
-latomic -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -fdiagnostics-urls=never -O1 -std=c11
-pedantic-errors -lm -mpcrel -mcpu=future -o c11-atomic-exec-1.exe

Compiler is trunk from about a week ago.

Reduced test case:

extern void abort (void);
extern void exit (int);
static void
test_simple_assign (void)
{
  do {
    do { static volatile _Atomic (long double) b = (long double) ((1));
      if (b != ((long double) ((1)))) abort ();
    } while (0);
  } while (0);
}

int
main (void)
{
  test_simple_assign ();
  exit (0);
}

The problem seems to be that with -mpcrel, we generate a plq for the load of
the long double constant and are swapping around the doublewords, which is only
needed for lq not plq.

The generated code with -mpcrel:

        plq 8,.LANCHOR0@pcrel
        mr 10,9
        mr 11,8
        cmpw 0,10,10
        bne- 0,$+4
        isync
        std 9,32(1)
        std 8,40(1)
        plfd 0,.LC0@pcrel
        plfd 1,.LC0+8@pcrel
        lfd 12,32(1)
        lfd 13,40(1)
        fcmpu 0,12,0
        bne 0,$+8
        fcmpu 0,13,1
        bne 0,.L4

And with -mno-pcrel:

        addis 9,2,.LANCHOR0@toc@ha
        addi 9,9,.LANCHOR0@toc@l
        lq 10,0(9)
        mr 8,10
        mr 9,11
        mr 10,11
        mr 11,8
        cmpw 0,10,10
        bne- 0,$+4
        isync
        std 9,32(1)
        std 8,40(1)
        addis 9,2,.LC0@toc@ha
        addi 9,9,.LC0@toc@l
        lfd 0,0(9)
        lfd 1,8(9)
        lfd 12,32(1)
        lfd 13,40(1)
        fcmpu 0,12,0
        bne 0,$+8
        fcmpu 0,13,1
        bne 0,.L4


More information about the Gcc-bugs mailing list