This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: mipsisa32-unknown-elf-as: Error: too large constant specified
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- To: Nigel Stephens <nigel at mips dot com>
- Cc: Ian Lance Taylor <ian at wasabisystems dot com>, Fred Fish <fnf at intrinsity dot com>, cgd at broadcom dot com, binutils at sources dot redhat dot com
- Date: Wed, 15 Oct 2003 17:34:45 +0200 (MET DST)
- Subject: Re: mipsisa32-unknown-elf-as: Error: too large constant specified
- Organization: Technical University of Gdansk
On Wed, 15 Oct 2003, Nigel Stephens wrote:
> Indeed. My argument is that it is "surprising" for the assembler to ever
> generate zero-extended 64-bit immediate values for any instruction that
> is not explicitly 64-bit. I agree that the logical operations, which
> don't have 64-bit variants, are a problem - but surely portability of
> existing 32-bit code is crucial. If I'm recompiling a 32-bit C program
> for the n32 ABI, then I don't expect to have to change anything - unless
> I explicitly use long long.
Well, I suppose we can add "dand", "dor" and "dxor" support to gas
(following the "dli" precedent), but a sane C compiler should be aware it
is generating n32 code and sign-extend immediates as appropriate itself in
the first place. And you shouldn't expect hand-written assembly to be
portable across ABIs, IMO.
> Now that seems perverse! It would be easy enough for an assembler
> programmer writing 64-bit code from scratch, and wanting a zero-extended
> operand for 'or', 'and', etc, to write their new code thusly:
>
> dli $3, 0x80000000
> or $2, $2, $3
>
>
> That's unambiguous, and puts the onus on the author of the 64-bit
> assembler source code.
It is, but one might want to write that as:
.set push
.set noat
dli $1, 0x80000000
or $2, $2, $1
.set pop
to avoid wasting a register and the resulting code starts becoming
obscure, sigh...
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +