[M3devel] m3cg right shift signed?
Hendrik Boom
hendrik at topoi.pooq.com
Tue Jun 9 14:38:29 CEST 2015
On Mon, Jun 08, 2015 at 06:44:07PM -0700, Jay wrote:
> (Not at propercomputer but sending anyway.)
>
> Is right shift of a signed type meant to be supported and well
> defined in the IR? I thought not, and assert so in the C backend. But
> it occurs now, from m3front/cg/set_range or such. Maybe change that
> to not? Surely unsigned types are adequate here?
Signed and unsigned right shifts are different on most hardware that
supports them. Signed shifts do sign extension, so that the shifts of
negative numbers remain negative. Unsigned shifts do zero extension.
There are (once were?) machines where shifts are (were?) faster
than division by powers of two.
Not sure how this relates to whatever in Modula 3 might or might not
require them, though.
-- hendrik
More information about the M3devel
mailing list