This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] adjust libgloss addresses for 64-bit


On Fri, 15 Apr 2005, Paul Koning wrote:

> So DLI loads a 64 bit int and LI a 32 bit int.  DLA loads a 64 bit
> address and LA a 32 bit address.  So the operand of LA should be a
> construct that is a valid 32 bit address (and 0x80000000 is one such)
> and it should be expanded into instructions that produce a valid
> representation of that address in a register (i.e., with sign
> extension if the registers are 64 bits).

 With, "li" vs "dli" the definition is rather obvious and unambiguous.  
It's not with "la" vs "dla".  With the (n)64 ABI what should the 
following macros expand to:

la	$2, 0x80000000
la	$2, 0x80000000($3)
la	$2, foo + 0x80000000($3)
la	$2, foo + 0xc000000080000000($3)

In particular, assuming the RHS operand is sign-extended, should "sll $2, 
$3, 0" be performed as a part of the three latters?  What about "foo"?  
Or the 64-bit offset?

 But in principle you are right for consistency the presence or the lack 
of the "d" prefix should imply the size of the operands used as it is so 
for other assembly instructions.  So how about disabling the "wrong" 
macros completely?  That is using as_bad() for these two "dla/la used to 
load..." messages just below "do_la" that are currently warnings.  After 
all these load address macros are the only place where non-default address 
calculation rules can be argued about at all -- the interpretation of 
e.g.:

lh	$2, 0x80000000
lh	$2, 0x80000000($3)
lh	$2, foo + 0x80000000($3)
lh	$2, foo + 0xc000000080000000($3)

is rather out of question, isn't it?

  Maciej


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]