mipsisa32-unknown-elf-as: Error: too large constant specified

Nigel Stephens nigel@mips.com
Wed Oct 15 00:58:00 GMT 2003



Ian Lance Taylor wrote:

>Hey, I'm easy.  Any opinions on this patch?  I haven't tried the
>testsuite yet.  In any case, clearly some new tests are called for
>here.
>
>  
>

I'm happy with it. But note that this doesn't return the behaviour to 
what cgd was seeing on the old assembler when compiling for a 64-bit 
ISA. It will now compile

        or      $2, $2, 0xe0000000
        and     $2, $2, ~0xe0000000

to the same sequence for both a 32 and 64-bit arch:

   0:   3c01e000        lui     at,0xe000
   4:   00411025        or      v0,v0,at
   8:   3c011fff        lui     at,0x1fff
   c:   3421ffff        ori     at,at,0xffff
  10:   00411024        and     v0,v0,at

But I'd claim that's correct: it's not sensible for the assembler to interpret immediate operands differently depending on the architecture. It should only interpret immediates as truly 64-bit if they are used with explicit 64-bit instructions (e.g. daddu, dli, etc), which is what this patch will do.

Ian wrote:

>With the patch I sent out, code like this will assemble without a
>warning on a 32-bit target:
>	and	$2, $2, 0xffffffffe0000000
>which is somewhat dubious.
>


Oh I don't know - that's a valid 32-bit immediate with 64-bit sign extension. The more ugly thing is that it would allow:

	and	$2,$2,0xffffffff1f000000 

But I'm prepared to look the other way if you are. :-)

Nigel




More information about the Binutils mailing list