How to write wrapper for VCVT ARM instruction?
Hi,
I am trying to write wrapper to use ARM instruction to float point to fixed point conversion.
Here is first idea:
__attribute_
int arm_F32toFixPoi
{
int y;
__asm__ __volatile__ (
"VCVT.s32.f32 %[y], %[x], %[bits]"
: [y] "=t" (y) /* output */
: [x] "t" (x), [bits] "I" (bits) /* input(s) */
: /* list of clobbered registers */);
return y;
}
But there is problem. I could work only if "x" and "y" are in same register.
How to tell GCC that input and output from ASM code are in same register, but with different type?
I try this, but it can't work anyway:
__attribute_
int arm_F32toFixPoi
{
__asm__ __volatile__ (
"VCVT.s32.f32 %[x], %[x], %[bits]"
: [x] "+t" (x) /* output */
: [bits] "I" (bits) /* input(s) */
: /* list of clobbered registers */);
return x; // <-here is problem. Compiler add instruction to convert "x" from "float" to int.
}
Any idea how to code this?
Jiri
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Thomas Preud'homme
- Solved:
- Last query:
- Last reply: