This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use VCVT arm-cortex A8 instruction in c++ file?

Note: This was originally posted on 28th April 2011 at http://forums.arm.com

Hi.....

I am facing some problem with using VCVT arm(cortex A8) instruction in c++ source file.

In some article, they mentioned like , The inline assembler does not provide direct support for VFP instructions like VCVT etc. So we need to use some equate assembly instructions.
I have tried with some equate instrcutions like FTOSI instruction also.It is not working.

I tried like,
__asm
{
   VCVT.S32.F32 source, destination
}

kindly help me if u peoples have any idea and give me some examples that how to use this instruction in c++ file?

I need to use CORTEX-A8 assembly instruction which is converting from floating point to integer in c++ source file.
Parents
  • Note: This was originally posted on 28th April 2011 at http://forums.arm.com


    kindly help me if u peoples have any idea and give me some examples that how to use this instruction in c++ file?

    I need to use CORTEX-A8 assembly instruction which is converting from floating point to integer in c++ source file.


    Does it really need to be an assembly instruction?  The compiler will use VCVT for the "obvoius" float to int convertion:

    int f(float f) { return (int)f; }

                   f PROC
    000000  eebd0ac0       VCVT.S32.F32 s0,s0
    000004  ee100a10       VMOV  r0,s0
    000008  e12fff1e       BX    lr


    Since inline asm allows expressions, you can probably use '(int)source' in the appropriate place in your inline asm.  [Note, I think you've reversed 'source' and 'destination' in you example.]

    If you really need to write the VCVT assembly instruction, then you'll have to use embedded asm http://infocenter.ar...c/Caciddae.html instead of inline asm.
Reply
  • Note: This was originally posted on 28th April 2011 at http://forums.arm.com


    kindly help me if u peoples have any idea and give me some examples that how to use this instruction in c++ file?

    I need to use CORTEX-A8 assembly instruction which is converting from floating point to integer in c++ source file.


    Does it really need to be an assembly instruction?  The compiler will use VCVT for the "obvoius" float to int convertion:

    int f(float f) { return (int)f; }

                   f PROC
    000000  eebd0ac0       VCVT.S32.F32 s0,s0
    000004  ee100a10       VMOV  r0,s0
    000008  e12fff1e       BX    lr


    Since inline asm allows expressions, you can probably use '(int)source' in the appropriate place in your inline asm.  [Note, I think you've reversed 'source' and 'destination' in you example.]

    If you really need to write the VCVT assembly instruction, then you'll have to use embedded asm http://infocenter.ar...c/Caciddae.html instead of inline asm.
Children
No data