[M3devel] word.insert/extract warnings/optimizations

Jay K jay.krell at cornell.edu
Sun Mar 7 10:12:38 CET 2010


 IO.PutInt(Word.Insert(a,b,20,20));
 IO.PutInt(Word.Extract(1,1,50));
 IO.PutInt(Word.Extract(1,30,30));



Tony, there's discrepancy between Word.Extract and Word.Insert.

m3front does a better job of checking and optimizing Word.Extract.

 

 

For Insert it always does a runtime add, and a runtime range check against

the number of bits in integer. It isn't wrong, just could be better.

 

 

For Extract, it checks either constant against the number of bits,

if they are both constant, it checks the sum and calls extract_mn.

  If they are both constant and the sum is too large, it just generates

   code to cause a range fault at runtime check_hi(1 vs. 0).

   Probably that could be a little more direct.

If one is constant it calls extract_n, or a slightly optimized use of extract if

the other is constant.

 

 

I'll probably tackle this soon.

 

 

 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100307/cb6512fa/attachment-0001.html>


More information about the M3devel mailing list