This is the mail archive of the gcc-help@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]
Other format: [Raw text]

MIPS inline assembly and floating point


Hi,

I am using a MIPS-variant compiler based on gcc-4.0.2. I am trying to use an inline assembly instruction in the code to use a special load instruction 'lwbufc1' that our prototype system supports. The syntax and semantics of the lwbufc1 are the same as lwc1 (loading from memory into a fp register), the only difference is in some caching functionality.

The C code looks like this:

int i,j;
float A[100];
float val,x;
asm volatile ("lwbufc1 %0, %1" : "=f" (val) : "m" (A[i]));
x = val * A[j];

However, when I compile it, the compiler correctly loads the value from A[i] into val, but then attempts to convert val from fixed-point to floating-point, using a cvt.s.w instruction. The assembly code looks like this:

...
lwbufc1 $f0, $(2)
cvt.s.w $f0, $f0
lwc1 $f2,-4($3)
mul.s $f0,$f0,$f2
...

Can I somehow tell the compiler (or assembler) that what I read from memory is already in floating-point format, and there is no need to convert? This seems to be the case when I don't use assembly inline directives, and the compiler uses a lwc1 instruction.

Is there a special constraint to the asm inline directive that I need to use in this case? I couldn't find anything even in http://gcc.gnu.org/svn/gcc/trunk/gcc/config/mips/constraints.md

Any help would be greatly appreciated.

Thanks,
George


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