Results 1 to 2 of 2
Hello everyone,
I am involved with the porting of GCC for a new arm processor.
The trouble is that I have to add a feature which is not supported by ...
- 08-14-2006 #1Just Joined!
- Join Date
- Aug 2006
- Posts
- 1
Fixed point support for GCC cross compiler
Hello everyone,
I am involved with the porting of GCC for a new arm processor.
The trouble is that I have to add a feature which is not supported by GCC - Fixed point support.
You know adding a new support along with porting is going to be tough.
Someone told me that one can add support in two ways.
1. Include the support through the compiler (change the internals).
2. Outside the compiler, through a library. (library support)
I am not sure which one to pursue.
The processor has a dedicated hardware support for fixed point operations.
Providing the support through a library is a good option when this is so?
Could anyone tell me which will be the best approach?
and why it is so?
or better could anyone give me an example so that I can use it as a reference
while porting?
Thanks in advance.
Mohamed Shafi.
shafitvm@yahoo.com
- 08-14-2006 #2
I use fixed point math on the Atmel AVR processors, but I don't need any support--I just do it all explicitely.
But if the ARM has hardware support, I would just write macros that take advantage of them and put them in a header file. For example, look at /usr/include/bits/mathinline.h as a random example of a macro using assembly code on Linux. Of course this is floating point stuff, but it illustrates how assembly opcodes can be called inline from C.
Also, /usr/include/bits/string.h has lots of examples unrelated to math.Code:#define isgreater(x, y) \ ({ register char __result; \ __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; })


Reply With Quote