From: user5857@newsgrouper.org.invalid   
      
   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   
      
   > So RV64GC is smallest for the globals/large-immediate test here, and   
   > only beaten by one byte by AMD64 for the array test.   
      
   Size is one thing, sooner or later one has to execute the instructions,   
   and here My 66000needs to execute fewer, while being within spitting   
   distance of code size.   
      
   > Looking at the   
   > code generated for the inner loop of arrays(), all the inner loops   
   > contain four instructions,   
      
   3 for My 66000   
      
   > so certainly in this case RV64GC is not   
   > crappier than the others. Interestingly, the reasons for using four   
   > instructions (rather than five) are different on these architectures:   
   >   
   > * RV64GC uses a compare-and-branch instruction.   
   > * AMD64 uses a load-and-add instruction.   
   > * ARM A64 uses an auto-increment instruction.   
    * My 66000 uses ST immediate for globals   
   >   
   > - anton   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|