<html><head><base href="x-msg://100/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>The front-end is supposed to be machine-independent. It has no idea what the underlying machine will do on overflow.</div><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" color="#0000FF" face="'Gill Sans'"><br></font></span></div></span></span></span></span></span></span></span></span></div></span></span></div><div><div>On 2 Mar 2010, at 08:16, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">Hey that's pretty clever.<br>It costs a register, but given:<br> <br> if (b >= constantX|| b <= -constantY)<br> a = 0;<br> <br>The C compiler instead does something like:<br> if ((b + constantY - 1) > (constantX + constantY - 1))<br> a = 0;<br> <br>This is something the front end could do in many cases.?<br>Adding a constant to eliminate one of the compares and branches is a win.<br>If an x86 compiler will give up a register for this, then it is probably a win everywhere.<br> <br>Granted, it probably requires silent overflow. Oh well.<br> <br> - Jay<br> <br>> Date: Tue, 2 Mar 2010 13:59:31 +0000<br>> To:<span class="Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>> From:<span class="Apple-converted-space"> </span><a href="mailto:jkrell@elego.de">jkrell@elego.de</a><br>> Subject: [M3commit] CVS Update: cm3<br>><span class="Apple-converted-space"> </span><br>> CVSROOT: /usr/cvs<br>> Changes by: jkrell@birch. 10/03/02 13:59:31<br>><span class="Apple-converted-space"> </span><br>> Modified files:<br>> cm3/m3-libs/m3core/src/Csupport/Common/: hand.c<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Log message:<br>> remove m3_shift64, which for the record was:<br>> uint64 __stdcall m3_shift64(uint64 a, int b)<br>> {<br>> if (b >= 64 || b <= -64)<br>> a = 0;<br>> else if (b > 0)<br>> a <<= b;<br>> else if (b < 0)<br>> a >>= -b;<br>> return a;<br>> }<br>><span class="Apple-converted-space"> </span><br>> _m3_shift64@12:<br>> 00000000: 55 push ebp<br>> 00000001: 8B EC mov ebp,esp<br>> 00000003: 8B 4D 10 mov ecx,dword ptr [ebp+10h]<br>> 00000006: 8D 41 3F lea eax,[ecx+3Fh]<br>> 00000009: 83 F8 7E cmp eax,7Eh<br>> 0000000C: 77 1C ja 0000002A<br>> 0000000E: 8B 45 08 mov eax,dword ptr [ebp+8]<br>> 00000011: 8B 55 0C mov edx,dword ptr [ebp+0Ch]<br>> 00000014: 85 C9 test ecx,ecx<br>> 00000016: 7E 07 jle 0000001F<br>> 00000018: E8 00 00 00 00 call __allshl<br>> 0000001D: EB 0F jmp 0000002E<br>> 0000001F: 7D 0D jge 0000002E<br>> 00000021: F7 D9 neg ecx<br>> 00000023: E8 00 00 00 00 call __aullshr<br>> 00000028: EB 04 jmp 0000002E<br>> 0000002A: 33 C0 xor eax,eax<br>> 0000002C: 33 D2 xor edx,edx<br>> 0000002E: 5D pop ebp<br>> 0000002F: C2 0C 00 ret 0Ch<br>><span class="Apple-converted-space"> </span><br></div></span></blockquote></div><br></body></html>