This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: mipsisa32-unknown-elf-as: Error: too large constant specified


Nigel Stephens wrote:
[snip]
> [If  the 'or' immediate operand is zero extended by the assembler to 
> 0x0000000080000000, then  we've now generated an invalid operand for 
> "addu", since  32-bit MIPS arithmetical operations are only defined to 
> generate valid results if their inputs are correctly sign-extended, in 
> other cases their result is "unpredictable".]
> 
> I'd have to rewrite the code like this to get the original 32-bit semantics:
> 
> 	li	$2, 0x1234
> 	or	$2, $2, 0xffffffff80000000
> 	addu	$2, $2, 1

That's not only ugly but inefficient, too.

	addiu	$2, $0, -0x1234
	addu	$2, $2, 1


Thiemo


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