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

Usage of YIELD instruction in ARM V8

Hi Experts,

What is the key usage of YIELD instruction in ARM V8 and when it will be generated by the compiler while compiling C to asm ?

Is there any scenario to experiment it ?

Parents
  • Hi,

    You would never see a YIELD instruction generated by compiling regular C code as it doesn't map to a C concept. If you needed the functionality it would be implemented using inline ASM or similar (probably wrapped up in a system library.)

    The purpose of YIELD is hint that the task performed by the current thread is of low importance so could potentially yield to another.

    YIELD is also an example of a special subgroup of instructions, the NOP hint instructions.  These instructions are allowed to implemented as a NOP or they might perform the specific function they are hinting. In practice most implementations will treat YIELD as a NOP, so it won't do anything.  This is because the YIELD behaviour is only really useful in CPUs with multiple hardware threads and all current ARM implementations are single threaded.

Reply
  • Hi,

    You would never see a YIELD instruction generated by compiling regular C code as it doesn't map to a C concept. If you needed the functionality it would be implemented using inline ASM or similar (probably wrapped up in a system library.)

    The purpose of YIELD is hint that the task performed by the current thread is of low importance so could potentially yield to another.

    YIELD is also an example of a special subgroup of instructions, the NOP hint instructions.  These instructions are allowed to implemented as a NOP or they might perform the specific function they are hinting. In practice most implementations will treat YIELD as a NOP, so it won't do anything.  This is because the YIELD behaviour is only really useful in CPUs with multiple hardware threads and all current ARM implementations are single threaded.

Children
No data