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/