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]

Re: PowerPC gas/ immediate range checking?


> Date: Fri, 25 May 2001 16:32:11 -0500
> From: Becky Gill <bgill@ibmoto.com>

> That makes sense from a compiler-generated code point of view.
> However, for those that hand-code their asm, it's counter-intuitive.
> Reading the arch manual (and having experience working with in-house
> pseudo-assemblers that only look at the lower 16 bits of the
> immediate), I'd expect the lower 16 bits to be smashed into the
> assembled instruction regardless of what the upper bits were.  I can
> see, though, wanting to be able to error-check the value in
> generated code.
> 
> The above option isn't an option for me, as I'm writing performance-oriented
> code, and adding instructions is not a good thing.

Only one alternative will generate correct code, so it's not a
performance issue; either you really meant to add 0x0000dead, or you
really meant to add 0xffffdead.

>  Using signed integer notation is also ugly and unreadable, as the
> number is an address that is generated by a macro. I guess I'll
> change my macros that generate the immediates to prepend the
> immediate with f's if it's meant to be negative.

Be aware that you might need to prepend 48 bits worth of 'f's, since
(at least on some hosts) gas uses 64-bit numbers internally.

> Actually, I'd already begun doing this - I was just hoping there was some
> option to disable the checking for non-generated code(the "-iknowwhatimdoing"
> option ;-), or that there was some way to stipulate that the 16-bit hex
> constant was meant to be treated as a signed 16-bit number.

Unfortunately, GAS doesn't have the concept of a '16-bit hex
constant'.  All small constants are the same size, either 32 or 64
bits depending on the host.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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