Re: darwin pgsql patches - Mailing list pgsql-patches

From Peter Eisentraut
Subject Re: darwin pgsql patches
Date
Msg-id Pine.LNX.4.30.0011300001510.3280-100000@peter.localdomain
Whole thread Raw
In response to Re: darwin pgsql patches  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane writes:

> > I think it has more to do with Apple's forked gcc than anything
> > else. I don't have a LinuxPPC machine to check if adding the rX syntax
> > there would continue to work.
>
> I do (have a LinuxPPC machine), so if you'd identify exactly what I
> should try, I'll be glad to check this point.  Seems like it'd be smart
> to minimize the number of PPC variants of this routine.

Minimize the differences between

+#if defined(darwin) && defined(__ppc__)
+static void
+tas_dummy()
+{
+       __asm__("               \n\
+               .globl  tas     \n\
+               .globl  _tas    \n\
+_tas:                          \n\
+tas:                           \n\
+               lwarx   r5,0,r3 \n\
+               cmpwi   r5,0    \n\
+               bne     fail    \n\
+               addi    r5,r5,1 \n\
+               stwcx.  r5,0,r3 \n\
+               beq     success \n\
+fail:          li      r3,1    \n\
+               blr             \n\
+success:                       \n\
+               li r3,0         \n\
+               blr             \n\
+       ");
+}
+
+#endif  /* __ppc__ && darwin */

and

[src/backend/storage/buffer/s_lock.c]
#if defined(__powerpc__)
/* Note: need a nice gcc constrained asm version so it can be inlined */
static void
tas_dummy()
{
        __asm__("               \n\
.global         tas             \n\
tas:                            \n\
                lwarx   5,0,3   \n\
                cmpwi   5,0     \n\
                bne     fail    \n\
                addi    5,5,1   \n\
                stwcx.  5,0,3   \n\
                beq     success \n\
fail:           li      3,1     \n\
                blr             \n\
success:                        \n\
                li 3,0          \n\
                blr             \n\
        ");
}

#endif   /* __powerpc__ */

under the constraint that the first version is probably not negotiable.
I'd like to wish that the GNU assembler is a little more forgiving.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: darwin pgsql patches
Next
From: Thomas Lockhart
Date:
Subject: Re: darwin pgsql patches