Related articles |
---|
Alpha assembly language - ldah/lda after jsr tim.jones@mail.com (2003-10-08) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr jvorbrueggen@mediasec.de (Jan C.=?iso-8859-1?Q?Vorbr=FCggen?=) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr firefly@diku.dk (Peter \Firefly\Lund) (2003-10-12) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-13) |
Re: Alpha assembly language - ldah/lda after jsr gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-10-13) |
From: | "Glen Herrmannsfeldt" <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | 12 Oct 2003 19:01:09 -0400 |
Organization: | Comcast Online |
References: | 03-10-040 |
Keywords: | assembler, optimize |
Posted-Date: | 12 Oct 2003 19:01:09 EDT |
"Timothy Jones" <tim.jones@mail.com> wrote in message
news:03-10-040@comp.compilers...
> Hi all,
>
> I have a problem with some alpha assembly code. Specifically with the
> ldah/lda pair of instructions to load the $gp after a function call.
> Initially the alpha compiler produces this:
>
> jsr $26, ($27), spec_getc!lituse_jsr!468
> ldl $1, ($12)
> ldah $gp, ($26)!gpdisp!469
> cmpeq $10, $0, $2
> cmplt $11, 255, $3
> lda $gp, 4($gp)!gpdisp!469
> ...
>
> which is all very well but if I want to change the schedule slightly
> by adding a nop like this:
>
> jsr $26, ($27), spec_getc!lituse_jsr!468
> nop
> ldl $1, ($12)
> ldah $gp, ($26)!gpdisp!469
> cmpeq $10, $0, $2
> cmplt $11, 255, $3
> lda $gp, 4($gp)!gpdisp!469
> ...
>
> then the program brings up the following fault:
>
> Unaligned access pid=26858 <bzip2.bad.mod> va=0x140009f5c
> pc=0x12000ed28 ra=0x12000ed38 inst=0xa77d80a0
>
> which is the next time the $gp register is used. Leaving the ldah
> instruction where it is (i.e. 2nd instruction after the jsr) means the
> program runs fine. Strangely, swapping it with the ldl above it (so it
> is immediately after the jsr) also produces this error. I don't really
> understand why this should be the case. I read that the ldah should
> get as it's argument a register containing its address, but the
> original code doesn't do this.
LDAH Ra.wq,disp.ab(Rb.ab)
The virtual address is computed by adding register Rb to 65536 times the
sign extended 16 bit displacement. The 64 bit result is written to Ra.
With no displacement, it would seem to copy Rb into Ra.
When you add a nop you did make sure that all addresses are still addressing
the right place. (I don't know if you are modifying the object program or
assembly source.)
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.