[LLVMdev] mips16 floating point

reed kotler rkotler at mips.com
Thu Jul 26 17:52:56 PDT 2012


Mips16 mode has no floating point instructions.

(Remember that mips16 is just an alternate decoder mode for the 
processor, mips32 or mips64
is the base processor).

Currently with gcc for mips16, when there is floating point it generates 
a function call to emulate each floating point instruction.

For mips 16 in llvm I want to just compile any function that has 
floating point, in mips32 mode.
The compression for mips32 to mips16 is less than 2x because sometimes 
you have to use the
extended mips16 instructions which are 4 bytes long (if immediate fields 
are too long for example).
So you almost could never win in real life by making those function 
calls for floating point instructions.

Later, when I have more time, I would like to go back and develop some 
metrics that allow me to make a better decision there because it is 
possible to change in-line to mips32/mip16 in a basic block or set of 
basic blocks with a lot of floating point activity, it would be possible 
to not have to do the whole function in mips32 if there is floating point.

So I need know if there was floating point in a function. Is there some 
easy way to know this already? (And if there is soft float then I would 
want to think that there is no floating point).

And then I need to be able to change the mode which currently is set for 
the duration of the compilation unit and set it for just a single function.

Maybe someone wants to add this or else maybe give me some hints as to 
how I would add this
functionality.

Even from c/c++, gcc lets you specify mips16 and mips32 by function 
using attributes.

I think that Simon from our team could make the clang changes for this 
if we need it and there
are no other volunteers to do it.

For now I'm interested in just the llvm changes for this.

A more general change is to allow me to change mode on a per basic block 
level.









More information about the llvm-dev mailing list