<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Division is among the slowest instructions that operates on integers even on modern hardware.<BR>It is/was frequently completely absent, though maybe those days are past.<BR>6502 and 65816 had no hardware multiply or divide, nor maybe signed shift.<BR> <BR> - Jay<br><br><br> <BR><div>> Date: Tue, 9 Jun 2015 08:38:29 -0400<br>> From: hendrik@topoi.pooq.com<br>> To: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] m3cg right shift signed?<br>> <br>> On Mon, Jun 08, 2015 at 06:44:07PM -0700, Jay wrote:<br>> > (Not at propercomputer but sending anyway.)<br>> > <br>> > Is right shift of a signed type meant to be supported and well <br>> > defined in the IR? I thought not, and assert so in the C backend. But <br>> > it occurs now, from m3front/cg/set_range or such. Maybe change that <br>> > to not? Surely unsigned types are adequate here?<br>> <br>> Signed and unsigned right shifts are different on most hardware that <br>> supports them. Signed shifts do sign extension, so that the shifts of <br>> negative numbers remain negative. Unsigned shifts do zero extension.<br>> <br>> There are (once were?) machines where shifts are (were?) faster <br>> than division by powers of two.<br>> <br>> Not sure how this relates to whatever in Modula 3 might or might not <br>> require them, though.<br>> <br>> -- hendrik<br></div> </div></body>
</html>