[PATCH] Fix implementation for Thumb ADR instruction

Tim Northover t.p.northover at gmail.com
Thu Jun 27 03:47:15 PDT 2013


Hi Mihail,

Good to see you posting again too.

> Please correct me if I'm wrong, but ARM does indeed use 2's complement
> arithmetic! There is indeed one slight deviation in that INT32_MIN is
> sometimes regarded as negative zero (maybe that's a relic for a distant
> dinosaur that used direct representation?) Either way, all ARM cores
> that I can think of use 2's complement with this little occasional quirk.
> Am I wrong here?

Ah, I see the branches do indeed use 2s complement. And the runtime
arithmetic is too, of course. But the offset versions of load/store
encode the immediate as a sign and distance.

So after your explanation I think I'm happy to let the template go in
at the start, with a name change to indicate what instructions it
applies to better ("memory offset" is a valid concept for ldr/str
too).

>I believe that that answer is "straight, natural" representation,
> but as I said, I'm not looking to fight a war
> over this. Just adding my two pence to the discussion.

It's a discussion that's been had multiple times in the past. As you
say, probably not worth pursuing again.

Cheers.

Tim.



More information about the llvm-commits mailing list