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: Ian Lance Taylor <ian at wasabisystems dot com>
- To: fnf at intrinsity dot com (Fred Fish)
- Cc: binutils at sources dot redhat dot com
- Date: 14 Oct 2003 16:12:12 -0700
- Subject: Re: mipsisa32-unknown-elf-as: Error: too large constant specified
- References: <20031014202625.DFBA52F2996@beeville.vert.intrinsity.com>
fnf@intrinsity.com (Fred Fish) writes:
> Before I report this as a bug, does anyone know if this is a
> deliberate change in behavior or a bug. Given the assembly input:
>
> $ cat a.s
> and $26, $26, ~(0xE0000000)
>
> an older assembler handles this just fine by using the $at register:
>
> $ /usr/local/sourceware/bin/mipsisa32-unknown-elf-as -v a.s
> GNU assembler version 2.14.90 (mipsisa32-unknown-elf) using BFD version 2.14.90 20030830
> $ /usr/local/sourceware/bin/mipsisa32-unknown-elf-objdump --disassemble a.o
>
> a.o: file format elf32-bigmips
>
> Disassembly of section .text:
>
> 00000000 <.text>:
> 0: 3c011fff lui at,0x1fff
> 4: 3421ffff ori at,at,0xffff
> 8: 0341d024 and k0,k0,at
>
> however a current build, using current CVS sources, treats it as an error:
>
> $ /build/sourceware/binutils/T-mipsisa32-unknown-elf/gas/as-new -v a.s
> GNU assembler version 2.14.90 (mipsisa32-unknown-elf) using BFD version 2.14.90 20031014
> a.s: Assembler messages:
> a.s:1: Error: too large constant specified
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.
Ian