Hi Richard,

    I've now ported most of the lockmeter code that was written at SGI for the x86 platform over to alpha.  My last stumbling block has been the rwlocks, as they had written some cute code that worked nicely on x86's rwlocks.  I've tried to rewrite it in Alpha assembly, but am now tripping over this one and have no clue why it's doing this.  This is done with "egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)".  The code segment is below, it's basically supposed to try once to get the read lock so we can start a timer if it fails (to keep track of our mean and total lock wait times):

static __inline__ int _read_try_lock_(volatile rwlock_t *lock)
{
        long temp,result;
        __asm__ __volatile__(
        "1:     ldl_l %1,%0\n"
        "       blbs %1,6f\n"
        "       subl %1,2,%1\n"
        "       mov %1,%2\n"
        "       stl_c %1,6f\n"
        "       beq %1,6f\n"
        "       mb\n"
        ".section .text2,\"ax\"\n"
        "6:\n"
        ".previous"
        : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result)
        : "m" (__dummy_lock(lock))
        );
        return (result);        /* Was the lock grabbed? */
}

This is the error I get:

[frival@av8r kernel]$ gcc -D__KERNEL__ -I/home/frival/lockwork/linux-2.3.22/include -Wall -Wstrict-prototypes -O2 -fno-strict-aliasing -D__SMP__ -pipe -mno-fp-regs -ffixed-8   -c -o lockmeter.o lockmeter.c
{standard input}: Assembler messages:
{standard input}:649: Error: macro requires $at register while noat in effect
{standard input}:655: Internal error!
Assertion failure in alpha_align at ./config/tc-alpha.c line 4518.
Please report this bug.

And finally, this is the final assembly code I get (with gcc -S):

<snip>
$_read_lock_..ng:
        subq $30,32,$30
        stq $26,0($30)
        .prologue 1
        bic $26,3,$26
        stq $16,16($30)
        bis $26,1,$17
        1:      ldl_l $2,0($16)
        blbs $2,6f
        subl $2,2,$2
        mov $2,$1
        stl_c $2,6f <-- line 649
        beq $2,6f
        mb
.section .text2,"ax"
6:
.previous
        addl $1,$31,$1 <-- line 655
        beq $1,$L944
        ldq $16,16($30)
        bis $31,$31,$18
        bsr $26,$lstat_update..ng
        br $31,$L943
<snip>