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




Ian Lance Taylor wrote:

Well, this example works fine:
	and $26, $26, (~(0xE0000000) & 0xffffffff)

Whether this is a bug or not is difficult to say.  What is the
precision of the ~ operator?  What's happening is that ~0xe0000000 is
being turned into 0xffffffff1fffffff.  That constant is indeed too
large.  Naturally you want ~0xe0000000 to be 0x1fffffff.  But,
currently, for any MIPS target, the assembler will do 64-bit
arithmetic.  Maybe for a 32 bit MIPS target the assembler should know
to use 32-bit arithmetic.  Unfortunately that would not be a trivial
change.




I believe that this new behaviour is broken. I don't think that gas should suddenly start interpreting immediate operands as 64-bit values, even when compiling for a 64-bit ISA, never mind for a 32-bit ISA - it's just going to break too much legacy assembler code. If a programmer wishes to use a 64-bit immediate they can easily enough code this as a "dli" followed by the appropriate instruction, which is what the assembler's going to expand it to anyway, and that avoids any ambiguity. (Of course it would be cool if the assembler supported the "LL" suffix on constants as a way to disambiguate, but that would be hard).


If load_register's "dbl" argument is not set then it should probably quietly sign-extend a value without a warning, so long as the top 32 bits are all zero.

Nigel

--
                        Nigel Stephens         Mailto:nigel@mips.com
   _    _ ____  ___     MIPS Technologies      Phone.: +44 1223 706200
   |\  /|||___)(___     The Fruit Farm         Direct: +44 1223 706207
   | \/ |||    ____)    Ely Road, Chittering   Fax...: +44 1223 706250
    TECHNOLOGIES UK     Cambridge CB5 9PH      Cell..: +44 7976 686470
                        England                http://www.mips.com



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