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

can coprocessor instruction be produced by compiler from c code

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

can accessing coprocessor instruction be produced by compiler from c code?

except float point instructions?

such like drain write buffer instruction?

any docs describe detail of this?
  • Note: This was originally posted on 19th April 2013 at http://forums.arm.com

    i know this feature, named register.

    i mean compiler translate c code to arm instructions. except this extension of c code added by specific compiler, can normal c code produce instructions like 'MCR'?

    etc, we write
    int a;
    int b;
    int c=a+b;

    this will translate to load and modify instructions.  or we can use hard-float to control translate to float instructions.

    how we can control coprocessor instructions produced from normall C code express?

    i think usually c code is used for moving data, so may not produce control instructions, is this right? any theory?
  • Note: This was originally posted on 22nd April 2013 at http://forums.arm.com

    What is your goal here?  Is it
    a: to make the compiler emit certain coprocessor instructions?  (If yes, please give an example)
    or
    b: to make sure the compiler *does not* emit any coprocessor instructions?  (If yes, why?)
  • Note: This was originally posted on 18th April 2013 at http://forums.arm.com

    Which compiler?

    If you are using armcc, I'd probably use the "named register" feature.  This lets you declare a variable and tie to a coprocessor register (or other kind of register).  Then whenever you access the variable the compiler will generate suitable coprocessor instructions.  So:

    egister unsigned int cp15_control __asm("cp15:0:c1:c0:0");

    This ties the variable to the coprocessor register "cp15:0:c1:c0:0".

    http://infocenter.arm.com/help/topic/com.arm.doc.dui0491i/CJAHJDBG.html

    I believe GCC has a similar feature, but not sure of the syntax.