Alpha assembly language - ldah/lda after jsr

tim.jones@mail.com (Timothy Jones)
8 Oct 2003 22:25:42 -0400

          From comp.compilers

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)
| List of all articles for this month |
From: tim.jones@mail.com (Timothy Jones)
Newsgroups: comp.compilers
Date: 8 Oct 2003 22:25:42 -0400
Organization: http://groups.google.com
Keywords: assembler, optimize, question
Posted-Date: 08 Oct 2003 22:25:42 EDT

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.


Has anyone got any suggestions of where to look for further
information? I've already been reading the Assembly Language
Programmer's Guide without much luck.


Thanks
Tim


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.