[PATCH, rs6000]: last few fixes to ppu_instrinsics.h

Ben Elliston bje@au1.ibm.com
Wed Sep 5 00:39:00 GMT 2007


This patch brings us up to date with the FSF mainline version of
ppu_intrinsics.h.  It may be that Andrew has introduced some of these
little divergences (to be precise, the *ptrp constraint letter and the
volatile qualifier on stdcx), but I can't tell, because he recently
committed the whole file and the change history is elsewhere.  Andrew,
could you please check?  Thanks.

Tested with a make check on powerpc.exp.

Cheers, Ben

2007-09-05  Ben Elliston  <bje@au.ibm.com>

        * config/rs6000/ppu_intrinsics.h (__ldarx): Use `Z' constraint,
        not `m' for *ptrp.
        (__stdcx): Make asm volatile.
        (__stwcx, __stdcx): Return only 0 or 1.

Index: config/rs6000/ppu_intrinsics.h
===================================================================
--- config/rs6000/ppu_intrinsics.h      (revision 128104)
+++ config/rs6000/ppu_intrinsics.h      (working copy)
@@ -356,7 +356,7 @@ typedef int __V4SI __attribute__((vector
     doublewordsize *ptrp = (doublewordsize*)(void*)(base);     \
   __asm__ volatile ("ldarx %0,%y1"                     \
           : "=r" (result)                              \
-          : "m" (*ptrp));                              \
+          : "Z" (*ptrp));                              \
   result; })
 #endif /* __powerpc64__ */
 
@@ -369,7 +369,7 @@ typedef int __V4SI __attribute__((vector
           : "=r" (result),                     \
             "=Z" (*ptrp)                       \
           : "r" (value) : "cr0");              \
-  (result & 0x20000000); })
+  ((result & 0x20000000) >> 29); })
 
 
 #ifdef __powerpc64__
@@ -377,12 +377,12 @@ typedef int __V4SI __attribute__((vector
   ({unsigned long long result;                         \
     typedef  struct {char a[8];} doublewordsize;       \
     doublewordsize *ptrp = (doublewordsize*)(void*)(base);     \
-  __asm__ ("stdcx. %2,%y1\n"                           \
+  __asm__ volatile ("stdcx. %2,%y1\n"                  \
           "\tmfocrf %0,0x80"                           \
           : "=r" (result),                             \
             "=Z" (*ptrp)                               \
           : "r" (value) : "cr0");                      \
-  (result & 0x20000000); })
+  ((result & 0x20000000) >> 29); })
 #endif /* __powerpc64__ */
 
 #define __mffs() __extension__                 \




More information about the Gcc-patches mailing list