This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

long double instructions dump core.


hi,
 The follwing code dumped on sparc.

----------------------------------------------------------------
c code:-

     1  main(){
     2  long double a=2e0;
     3  int i;
     4  for(i=0;i<10000000;i++)
     5          a=a+2;
     6  printf("%Lfg\n",a);
     7  }
----------------------------------------------------------------
The following code when it is compiled with cc1 of gcc and linked with
 the assembler of sun it dumps core. 

Machine details:-
cpu-ultrasparc,instruction set - sparcv9.

The s file generated has the following instructions. It has a call
to the function _Qp_add. It passes the parmaeters in %f0 and %f4.
---------------------------------------------------------------------
.LL6:
        sethi   %hh(.LLC0), %o0
        sethi   %lm(.LLC0), %o1
        or      %o0, %hm(.LLC0), %o0
        sllx    %o0, 32, %o0
        add     %o0, %o1, %o0
        or      %o0, %lo(.LLC0), %o0
        ldd     [%fp+2015], %f0          <---------
        ldd     [%fp+2023], %f2
        ldd     [%o0], %f4               <---------
        ldd     [%o0+8], %f6
        call    _Qp_add, 0
         nop
        fmovd   %f0, %f4
        fmovd   %f2, %f6
        std     %f4, [%fp+2015]
        std     %f6, [%fp+2023]
------------------------------------------------------------------------
Where as the Sun c compiler passes a pointers to the two arguments in %o0
and %o1.

The code from the .s file

         or      %l0,%g1,%l0
        ldd     [%l0+0],%f12
        ldd     [%l0+8],%f14
        add     %fp,1991,%o0    <-------
        std     %f8,[%fp+1975]
        std     %f10,[%fp+1983]
        std     %f12,[%fp+1959]
        std     %f14,[%fp+1967]
        add     %fp,1975,%o1     <------
        call    _Qp_add
        add     %fp,1959,%o2
        ldd     [%fp+1991],%f8
        ldd     [%fp+1999],%f10

---------------------------------------------------------------------

Is it something the the long double operations are not ABI complaint
in gcc.

When the same code is compiled with the option -mhard-quad-float for
cc1. It generates a faddq instruction and it is quite slower. why ?







-----------------------------------------------------------------------
 M.V.S. Phani Narasimham	  
 Global R & D Solutions	    	 
 1 st Block,7 th main road,No:8
 Kormangla
 BANGLORE-36 , India
 Ph- 5530053 ext.1053           
 E-MAIL- phani.sesha@wipro.com
 www.wipro.com
 The World's First SEI CMM LEVEL 5 Software Services Company
-----------------------------------------------------------------------




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]