https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122041

--- Comment #3 from Petr Sumbera <sumbera at volny dot cz> ---
With following change:

--- Makefile
+++ Makefile
@@ -5,7 +5,7 @@
        $(GCC) -o test.o -c test.c

 crc-gcc.o: crc.c
-       $(GCC) -O4 -funroll-loops -finline-functions -fstrict-aliasing -o
crc-gcc.o -c crc.c
+       $(GCC) -O3 -funroll-loops -mcpu=niagara4 -mtune=niagara4 -o crc-gcc.o
-c crc.c

 crc-studio.o: crc.c
        $(STUDIO) -m64 -xO4 -xtarget=generic -xarch=sparcvis -xchip=generic
-xregs=no%appl -xmemalign=16s -o crc-studio.o -c crc.c

===

I get (on SPARC-T5 system):

PATH=/usr/gcc/15/bin/:/usr/bin gmake test
gcc -o test.o -c test.c
gcc -O3 -funroll-loops -mcpu=niagara4 -mtune=niagara4 -o crc-gcc.o -c crc.c
gcc -o test-gcc test.o crc-gcc.o
/opt/developerstudio12.6/bin/cc -m64 -xO4 -xtarget=generic -xarch=sparcvis
-xchip=generic -xregs=no%appl -xmemalign=16s -o crc-studio.o -c crc.c
gcc -o test-studio test.o crc-studio.o
time ./test-gcc

real       33.6
user       33.6
sys         0.0
time ./test-studio

real       14.4
user       14.4
sys         0.0

===

$ gobjdump -dr crc-gcc.o

crc-gcc.o:     file format elf64-sparc-sol2


Disassembly of section .text:                                                   

0000000000000000 <crc32_update_no_xor>:                                         
   0:   9d e3 bf 40     save  %sp, -192, %sp
   4:   b4 0e bf f8     and  %i2, -8, %i2                                       
   8:   12 e6 ab 00     unknown
   c:   27 00 00 00     sethi  %hi(0), %l3                                      
                        c: R_SPARC_H44  .rodata
  10:   ba 10 20 ff     mov  0xff, %i5                                          
  14:   82 14 e0 00     mov  %l3, %g1
                        14: R_SPARC_M44 .rodata                                 
  18:   a5 2f 70 30     sllx  %i5, 0x30, %l2
  1c:   85 28 70 0c     sllx  %g1, 0xc, %g2                                     
  20:   a3 2f 70 28     sllx  %i5, 0x28, %l1
  24:   a1 2f 70 20     sllx  %i5, 0x20, %l0                                    
  28:   a8 10 20 00     clr  %l4
  2c:   a6 10 a0 00     mov  %g2, %l3                                           
                        2c: R_SPARC_L44 .rodata
  30:   37 3f c0 00     sethi  %hi(0xff000000), %i3                             
  34:   39 00 3f c0     sethi  %hi(0xff0000), %i4
  38:   bb 2f 70 08     sllx  %i5, 8, %i5                                       
  3c:   92 06 40 14     add  %i1, %l4, %o1
  40:   94 10 20 08     mov  8, %o2                                             
  44:   90 07 a7 f7     add  %fp, 0x7f7, %o0
  48:   40 00 00 00     call  48 <crc32_update_no_xor+0x48>                     
                        48: R_SPARC_WDISP30     memcpy
  4c:   a8 05 20 08     add  %l4, 8, %l4                                        
  50:   ca 5f a7 f7     ldx  [ %fp + 0x7f7 ], %g5
  54:   89 31 70 38     srlx  %g5, 0x38, %g4                                    
  58:   87 29 70 28     sllx  %g5, 0x28, %g3
  5c:   83 29 70 38     sllx  %g5, 0x38, %g1                                    
  60:   90 08 c0 12     and  %g3, %l2, %o0
  64:   93 29 70 18     sllx  %g5, 0x18, %o1                                    
  68:   82 10 40 04     or  %g1, %g4, %g1
  6c:   94 0a 40 11     and  %o1, %l1, %o2                                      
  70:   97 29 70 08     sllx  %g5, 8, %o3
  74:   82 10 40 08     or  %g1, %o0, %g1                                       
  78:   98 0a c0 10     and  %o3, %l0, %o4
  7c:   9b 31 70 08     srlx  %g5, 8, %o5                                       
  80:   82 10 40 0a     or  %g1, %o2, %g1
  84:   84 0b 40 1b     and  %o5, %i3, %g2                                      
  88:   89 31 70 18     srlx  %g5, 0x18, %g4
  8c:   82 10 40 0c     or  %g1, %o4, %g1                                       
  90:   86 09 00 1c     and  %g4, %i4, %g3
  94:   82 10 40 02     or  %g1, %g2, %g1                                       
  98:   8b 31 70 28     srlx  %g5, 0x28, %g5
  9c:   90 09 40 1d     and  %g5, %i5, %o0                                      
  a0:   82 10 40 03     or  %g1, %g3, %g1
  a4:   82 10 40 08     or  %g1, %o0, %g1                                       
  a8:   b0 18 40 18     xor  %g1, %i0, %i0
  ac:   92 0e 20 ff     and  %i0, 0xff, %o1                                     
  b0:   95 36 30 30     srlx  %i0, 0x30, %o2
  b4:   96 02 67 00     add  %o1, 0x700, %o3                                    
  b8:   98 0a a0 ff     and  %o2, 0xff, %o4
  bc:   9b 36 30 28     srlx  %i0, 0x28, %o5                                    
  c0:   83 36 30 38     srlx  %i0, 0x38, %g1
  c4:   87 2a f0 02     sllx  %o3, 2, %g3                                       
  c8:   84 03 21 00     add  %o4, 0x100, %g2
  cc:   8a 0b 60 ff     and  %o5, 0xff, %g5                                     
  d0:   89 36 30 20     srlx  %i0, 0x20, %g4
  d4:   83 28 70 02     sllx  %g1, 2, %g1                                       
  d8:   91 28 b0 02     sllx  %g2, 2, %o0
  dc:   d4 04 c0 03     ld  [ %l3 + %g3 ], %o2                                  
  e0:   99 36 30 18     srlx  %i0, 0x18, %o4
  e4:   92 01 62 00     add  %g5, 0x200, %o1                                    
  e8:   96 09 20 ff     and  %g4, 0xff, %o3
  ec:   c2 04 c0 01     ld  [ %l3 + %g1 ], %g1                                  
  f0:   8b 2a 70 02     sllx  %o1, 2, %g5
  f4:   da 04 c0 08     ld  [ %l3 + %o0 ], %o5                                  
  f8:   88 02 e3 00     add  %o3, 0x300, %g4
  fc:   86 0b 20 ff     and  %o4, 0xff, %g3                                     
 100:   85 36 30 10     srlx  %i0, 0x10, %g2
 104:   91 29 30 02     sllx  %g4, 2, %o0                                       
 108:   92 00 e4 00     add  %g3, 0x400, %o1
 10c:   96 08 a0 ff     and  %g2, 0xff, %o3                                     
 110:   b1 36 30 08     srlx  %i0, 8, %i0
 114:   de 04 c0 05     ld  [ %l3 + %g5 ], %o7                                  
 118:   99 2a 70 02     sllx  %o1, 2, %o4
 11c:   ca 04 c0 08     ld  [ %l3 + %o0 ], %g5                                  
 120:   88 02 e5 00     add  %o3, 0x500, %g4
 124:   86 0e 20 ff     and  %i0, 0xff, %g3                                     
 128:   85 29 30 02     sllx  %g4, 2, %g2
 12c:   d0 04 c0 0c     ld  [ %l3 + %o4 ], %o0                                  
 130:   92 00 e6 00     add  %g3, 0x600, %o1
 134:   d6 04 c0 02     ld  [ %l3 + %g2 ], %o3                                  
 138:   82 18 40 0a     xor  %g1, %o2, %g1
 13c:   95 2a 70 02     sllx  %o1, 2, %o2                                       
 140:   82 18 40 0d     xor  %g1, %o5, %g1
 144:   da 04 c0 0a     ld  [ %l3 + %o2 ], %o5                                  
 148:   9e 18 40 0f     xor  %g1, %o7, %o7
 14c:   b0 1b c0 05     xor  %o7, %g5, %i0                                      
 150:   98 1e 00 08     xor  %i0, %o0, %o4
 154:   8a 1b 00 0b     xor  %o4, %o3, %g5                              
 158:   88 19 40 0d     xor  %g5, %o5, %g4
 15c:   b1 31 20 00     srl  %g4, 0, %i0                                        
 160:   38 fe 96 f4     unknown
 164:   01 00 00 00     nop                                                     
 168:   81 cf e0 08     return  %i7 + 8
 16c:   01 00 00 00     nop                                                     
 170:   30 68 00 04     b,a   %xcc, 180 <crc32_update_no_xor+0x180>
 174:   01 00 00 00     nop                                                     
 178:   01 00 00 00     nop  
 17c:   01 00 00 00     nop

Reply via email to