From: anton@mips.complang.tuwien.ac.at   
      
   Krishna Myneni writes:   
   >On 3/28/24 03:49, Anton Ertl wrote:   
   >> Here's some data about the occurences in the Gforth image:   
   >>   
   >> Non-constant shift amount:   
   >> 2 lshift   
   >> 1 rshift   
   >> 0 arshift   
   >>   
   >> Constant shift amount:   
   >> 18 lit lshift   
   >> 41 lit rshift   
   >> 0 lit arshift   
   >>   
   >...   
   >   
   >Checking the Forth code base which I use, I find ~ 100:1 ratio between   
   >uses of constant shift amount to non-constant shifts. The existing   
   >instances of non-constant shifts are comparable to yours: two in number   
   >theory programs e.g., finding an exact fraction for a floating point   
   >number, and one use in the assembler.   
   >   
   >I don't know what to conclude from this other than the kind of   
   >application development I have been doing favors one over the other.   
      
   It shows that Forth systems that support special code generation for   
   operations with constants (probably all native-code systems, as well   
   as Gforth) would be able to generate the same code in the vast   
   majority of cases even with the change you propose. Only in the few   
   non-constant cases a few extra instructions would be needed.   
      
   - anton   
   --   
   M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html   
   comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html   
    New standard: https://forth-standard.org/   
    EuroForth 2023: https://euro.theforth.net/2023   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|