home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 130,644 of 131,241   
   MitchAlsup to All   
   Re: Variable-length instructions   
   28 Dec 25 23:48:43   
   
   From: user5857@newsgrouper.org.invalid   
      
   Stephen Fuld  posted:   
      
   > On 12/28/2025 8:22 AM, John Savard wrote:   
   > > On Mon, 22 Dec 2025 20:00:06 +0000, Waldek Hebisch wrote:   
   > >> John Savard  wrote:   
   > >>> On Thu, 18 Dec 2025 22:25:08 +0000, Anton Ertl wrote:   
   > >>>   
   > >>>> It is certainly possible to decode potential instructions at every   
   > >>>> starting position in parallel, and later select the ones that actually   
   > >>>> correspond to the end of the previous instruction,   
   > >>>   
   > >>> Oh, yes, I had always realized that, but dismissed it as far too   
   > >>> wasteful.   
   > >>   
   > >> Well, Mitch claims average 35 bits per instructions, that means about   
   > >> 90% utilization of decoders, so not bad.   
   > >   
   > > His minimum instruction size is 32 bits, but I was going for 16 bits.   
   > >   
   > >> Also, consider that alternative to variable length instructions is to   
   > >> use longer instructions or more of them.   
   > >   
   > > What I did instead was use variable-length instructions, but add a prefix   
   > > at the beginning of any 256-bit block of instructions that contained them   
   > > which directly showed where each instruction began.   
   > >   
   > > My intent was to avoid the disadvantages you identify for fixed-length   
   > > instructions, but avoid the disadvantage of variable-length instructions   
   > > too.   
   >   
   > I understand your goal, however . . .   
   >   
   > How many bits do you "waste" on the prefix?   
   >   
   > Since I think any branch must target the beginning of a block, and in   
   > general, a routine will not end on a block boundary, there will be   
   > "wasted" bits at the end of the last block before a "label".  Have you   
   > determined for a "typical" program, how many bits are wasted due to this?   
   >   
   > The point I am making is that you will "cancel" at least some of the   
   > savings of 16 bit instructions.  You should take this into account   
   > before committing to your plan.   
      
   Consider "Duff's Device"::   
      
   {   
       int n = (count + 7) / 8;   
       switch (count % 8) {   
       case 0: do { *to = *from++;   
       case 7:      *to = *from++;   
       case 6:      *to = *from++;   
       case 5:      *to = *from++;   
       case 4:      *to = *from++;   
       case 3:      *to = *from++;   
       case 2:      *to = *from++;   
       case 1:      *to = *from++;   
               } while (--n > 0);   
       }   
   }   
      
   It seems to me that each *to++ = *from**; will be in its own block ?!?!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca