From: sfuld@alumni.cmu.edu.invalid   
      
   On 9/4/2025 8:23 AM, MitchAlsup wrote:   
   >   
   > MitchAlsup posted:   
   >   
   >>   
   >> anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:   
   >>   
   >>> BGB writes:   
   >>>> But, it seems to have a few obvious weak points for RISC-V:   
   >>>> Crappy with arrays;   
   >>>> Crappy with code with lots of large immediate values;   
   >>>> Crappy with code which mostly works using lots of global variables;   
   >>>> Say, for example, a lot of Apogee / 3D Realms code;   
   >>>> They sure do like using lots of global variables.   
   >>>> id Software also likes globals, but not as much.   
   >>>> ...   
   >>>   
   >>> Let's see:   
   >>>   
   >>> #include    
   >>>   
   >>> long arrays(long *v, size_t n)   
   >>> {   
   >>> long i, r;   
   >>> for (i=0, r=0; i>> r+=v[i];   
   >>> return r;   
   >>> }   
   >>   
   >> arrays:   
   >> MOV R3,#0   
   >> MOV R4,#0   
   >> VEC R5,{}   
   >> LDD R6,[R1,R3<<3]   
   >> ADD R4,R4,R6   
   >> LOOP LT,R3,#1,R2   
   >> MOV R1,R4   
   >> RET   
   >>   
   >>>   
   >>> long a, b, c, d;   
   >>>   
   >>> void globals(void)   
   >>> {   
   >>> a = 0x1234567890abcdefL;   
   >>> b = 0xcdef1234567890abL;   
   >>> c = 0x567890abcdef1234L;   
   >>> d = 0x5678901234abcdefL;   
   >>> }   
   >>   
   >> globals:   
   >> STD #0x1234567890abcdef,[ip,a-.]   
   >> STD #0xcdef1234567890ab,[ip,b-.]   
   >> STD #0x567890abcdef1234,[ip,c-.]   
   >> STD #0x5678901234abcdef,[ip,d-.]   
   >> RET   
   >>>   
   >> -----------------   
   >>>   
   >>> So, the overall sizes (including data size for globals() on RV64GC) are:   
   >>> Bytes Instructions   
   >>> arrays globals Architecture arrays globals   
   >>> 28 66 (34+32) RV64GC 12 9   
   >>> 27 69 AMD64 11 9   
   >>> 44 84 ARM A64 11 22   
   >> 32 68 My 66000 8 5   
   >   
   > In light of the above, what do people think is more important, small   
   > code size or fewer instructions ??   
   >   
   > At some scale, smaller code size is beneficial, but once the implementation   
   > has a GBOoO µarchitecture, I would think that fewer instructions is better   
   > than smaller code--so long as the code size is less than 150% of the smaller   
   > AND so long as the ISA does not resort to sequential decode (i.e., VAX).   
   >   
   > What say ye !   
      
   In general yes, but as you pointed out in another post, if you are   
   talking about a GBOoO machine, it isn't the absolute number of   
   instructions (because of parallel execution), but the number of cycles   
   to execute a particular routine. Of course, this is harder to tell at a   
   glance from a code listing.   
      
   And, of course your "150%" is arbitrary, but I agree that small   
   differences in code size are not important, except in some small   
   embedded applications.   
      
   And I guess I would add, as a third, much lower priority, power usage.   
      
      
   --   
    - 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)   
|