public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
@ 2020-04-16 15:48 acsawdey at gcc dot gnu.org
  2020-04-16 16:27 ` [Bug target/94622] " acsawdey at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-16 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
@ 2020-04-16 16:27 ` acsawdey at gcc dot gnu.org
  2020-04-17 22:26 ` acsawdey at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-16 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

acsawdey at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-16
           Assignee|unassigned at gcc dot gnu.org      |acsawdey at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
  2020-04-16 16:27 ` [Bug target/94622] " acsawdey at gcc dot gnu.org
@ 2020-04-17 22:26 ` acsawdey at gcc dot gnu.org
  2020-04-20 17:56 ` acsawdey at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-17 22:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from acsawdey at gcc dot gnu.org ---
Compiling with -dap we see:

        sync             # 7    [c=12 l=4]  *hwsync
        plq 8,.LANCHOR0@pcrel            # 8    [c=8 l=12]  load_quadpti
        mr 10,9          # 9    [c=4 l=4]  *movdi_internal64/2
        mr 11,8          # 10   [c=4 l=4]  *movdi_internal64/2

I think the problem is that atomic_load<mode> thinks it always needs to do a
doubleword swap if little endian for TImode, which is true for lq, but not for
plq.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
  2020-04-16 16:27 ` [Bug target/94622] " acsawdey at gcc dot gnu.org
  2020-04-17 22:26 ` acsawdey at gcc dot gnu.org
@ 2020-04-20 17:56 ` acsawdey at gcc dot gnu.org
  2020-04-21 21:16 ` acsawdey at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-20 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from acsawdey at gcc dot gnu.org ---
Solution is going to be to always use plq if prefixed, which makes sense anyway
for little endian because it avoids the ugly doubleword swap.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-04-20 17:56 ` acsawdey at gcc dot gnu.org
@ 2020-04-21 21:16 ` acsawdey at gcc dot gnu.org
  2020-04-22 17:20 ` cvs-commit at gcc dot gnu.org
  2020-04-22 21:47 ` acsawdey at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-21 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from acsawdey at gcc dot gnu.org ---
I'm wondering if the same problem exists for atomic_store<mode>, store_quadpti,
and pstq vs stq?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-04-21 21:16 ` acsawdey at gcc dot gnu.org
@ 2020-04-22 17:20 ` cvs-commit at gcc dot gnu.org
  2020-04-22 21:47 ` acsawdey at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-22 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aaron Sawdey <acsawdey@gcc.gnu.org>:

https://gcc.gnu.org/g:3bcdb5dec72b6d7b197821c2b814bc9fc07f4628

commit r10-7889-g3bcdb5dec72b6d7b197821c2b814bc9fc07f4628
Author: Aaron Sawdey <acsawdey@linux.ibm.com>
Date:   Mon Apr 20 13:01:43 2020 -0500

    Use plq/pstq for atomic_{load,store}<mode>

    For future architecture with prefix instructions, always use plq/pstq
    rather than lq/stq for atomic load of quadword. Then we never have to
    do the doubleword swap on little endian. Before this fix, -mno-pcrel
    would generate lq with the doubleword swap (which was ok) and -mpcrel
    would generate plq, also with the doubleword swap, which was wrong.

    2020-04-20  Aaron Sawdey  <acsawdey@linux.ibm.com>

            PR target/94622
            * config/rs6000/sync.md (load_quadpti): Add attr "prefixed"
            if TARGET_PREFIXED.
            (store_quadpti): Ditto.
            (atomic_load<mode>): Do not swap doublewords if TARGET_PREFIXED as
            plq will be used and doesn't need it.
            (atomic_store<mode>): Ditto, for pstq.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/94622] testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel
  2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-04-22 17:20 ` cvs-commit at gcc dot gnu.org
@ 2020-04-22 21:47 ` acsawdey at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-04-22 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

acsawdey at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from acsawdey at gcc dot gnu.org ---
Fixed in trunk.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-22 21:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 15:48 [Bug target/94622] New: testsuite/gcc.dg/atomic/c11-atomic-exec-1.c fails on powerpc64le with -mpcrel acsawdey at gcc dot gnu.org
2020-04-16 16:27 ` [Bug target/94622] " acsawdey at gcc dot gnu.org
2020-04-17 22:26 ` acsawdey at gcc dot gnu.org
2020-04-20 17:56 ` acsawdey at gcc dot gnu.org
2020-04-21 21:16 ` acsawdey at gcc dot gnu.org
2020-04-22 17:20 ` cvs-commit at gcc dot gnu.org
2020-04-22 21:47 ` acsawdey at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).