public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/58330] New: powerpc64 atomic store split in two
@ 2013-09-06  2:01 anton at samba dot org
  2013-09-06  2:17 ` [Bug target/58330] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anton at samba dot org @ 2013-09-06  2:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58330

            Bug ID: 58330
           Summary: powerpc64 atomic store split in two
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at samba dot org

We found an issue when building the powerpc64 little endian kernel where a 64
bit store was split into two 32 bit stores. Since there is no 64 bit byte
reversed store on POWER6 and earlier, gcc decided to use two 32 bit byte
reversed stores. We were unable to fix this, even with atomic builtins.

I think splitting the store even in the non atomic builtin case is suspect
since we have lots of places in the kernel that rely on naturally aligned loads
and stores being done atomically.

An example:

static inline void __raw_writeq (unsigned long v, void *addr)
{
#if 1
        __atomic_store_n ((unsigned long *) addr, v, __ATOMIC_RELAXED);
#else
        *(volatile unsigned long *)addr = v;
#endif
}

void foo (void *addr, unsigned long start)
{
        unsigned long reverse = __builtin_bswap64 (start);
        __raw_writeq (reverse, addr);
}

gives:

    li 9,4
    srdi 10,4,32
    stwbrx 4,0,3
    stwbrx 10,9,3


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

end of thread, other threads:[~2013-09-23 14:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06  2:01 [Bug middle-end/58330] New: powerpc64 atomic store split in two anton at samba dot org
2013-09-06  2:17 ` [Bug target/58330] " pinskia at gcc dot gnu.org
2013-09-06  2:38 ` amodra at gmail dot com
2013-09-09 23:48 ` amodra at gcc dot gnu.org
2013-09-10  8:39 ` amodra at gcc dot gnu.org
2013-09-23 14:27 ` amodra at gcc dot gnu.org
2013-09-23 14:28 ` amodra at gcc dot gnu.org
2013-09-23 14:28 ` amodra at gmail dot com
2013-09-23 14:29 ` amodra at gmail dot com

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).