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,643 of 131,241   
   Stephen Fuld to MitchAlsup   
   Re: Variable-length instructions   
   28 Dec 25 15:19:41   
   
   From: sfuld@alumni.cmu.edu.invalid   
      
   On 12/28/2025 1:32 PM, MitchAlsup wrote:   
   >   
   > 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?   
   >   
   > For code like:: (undoctored compiler output)   
   >   
   > .LBB1_34:   
   > 	mov	r1,#0   
   > 	br	.LBB1_35   
   > .LBB1_39:   
   > 	mov	r1,#28   
   > 	exit	r16,r0,0,32   
   > .LBB1_36:   
   > 	mov	r1,#0   
   > 	exit	r16,r0,0,32   
   > .LBB1_37:   
   > 	call	processRestart   
   > 	beq0	r1,.LBB1_38   
   > .LBB1_35:   
   > 	exit	r16,r0,0,32   
   > .LBB1_38:   
   > 	lduh	r1,[ip,gRestartsLeft]   
   > 	br	.LBB1_2   
   > .Lfunc_end1:   
   >   
   > You are going to eat a lot of headers for 2 instruction BBs.   
   >   
   > Also:: Can you return to the middle of a block ??   
   >         Can you make multiple CALLs from a single block ??   
   >         Can you fit an entire loop in a single block ??   
   >         Can you fit a loop with calls in a single block ??   
   >         Does each unique label of a switch(i) require its own block ??   
   >   
   >> 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.   
   >   
   > I suspect the block-boundaries will consume more space than the 16-bit   
   > instructions can possibly save.   
      
   I agree with your suspicions.  I was trying to get John to reach that   
   same conclusion.  :-)   
      
      
      
   --   
     - Stephen Fuld   
   (e-mail address disguised to prevent spam)   
      
   --- 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