Re: A89: TI-GCC help needed


[Prev][Next][Index][Thread]

Re: A89: TI-GCC help needed




Harry Tuttle writes:

 >   Here is a silly question.  Gcc has to support compilation to a 68k without 
 > a coprossor right?  Why can't one just use the right switch to generate code 
 > for a 68k w/o a coporssor.  Then you could get to use floats in their full 
 > glory.  Right?  
 
Well, the question is not silly. If you have a coprocessor then all
double and floats are treated by that so the compiler can directly
utilise its capabilities. You can tell the compiler not to do so,
as Robin Kirkman writes:

 ] 
 ] Actually, there -is- a software float flag you can pass to gcc. 
 ] the flag is -msoft-float
 ] 

Now, a few things to clarify:

-msoft-float instructs the compiler not to generate coprocessor
instructions, that is, when you want to add two double numbers, 
it will not generate instructions like

  fadd.d f0,fp1
  
Since the 68000 does not have a coprocessor interface, nor does it 
have a proper exception model, when you compile to 68000 gcc 
will automaticaly turn -msoft-float on.

This means that the question is still not answered. OK, gcc will not
generate fadd and fmul and alike, but what will it do if it has to add 
two floats or doubles ?

Well, it will assume that there are functions in a library which will
add two doubles or floats, or multiply them, or convert them between
each other or integers and all sort of similar stuff. It will generate 
calls for them. At link time you will get unresolved symbol errors for 
functions like __muldf3 and alike. These functions are *not* supplied
with the compiler, you have to get them from any place you like. There 
are other such support functions, for example, the 68000 can not
divide two longs. When you have a long * long in your C source, it
will generate a call to a function called __mulsi3.
Now the basic 68000 gcc support library (that is, everything except long
longs and floatpoint) is quite simple and can probably be found on the 
Net. (If not, you can hack it together in two days.) Floats are a
different kettle of fish, especially if you are targeting for IEEE 
compliance.

This is what you (and others) are lacking: a basic float point C 
support library for gcc. I do not know any freely available such
package (yet).

Regards,

Zoltan


Follow-Ups: References: