5 IAR Intrinsic Functions

This section shows a summary of IAR intrinsic functions and the best MPLAB XC8 replacement where that is available. These intrinsic functions and their MPLAB XC8 equivalents are discussed in more detail in the sections that follow. Note that what is referred to as an intrinsic function by IAR documentation is known as a built-in function in the MPLAB XC context. It is recommended that you compare the relevant sections in the MPLAB® XC8 C Compiler User's Guide for AVR MCUs with those in your IAR C/C++ Compiler User Guide to ensure that migrated code will work as expected in all situations.

Table 5-1. Summary of Suggested Migrations/Migration Suggestions from IAR Intrinsic Functions
IAR Intrinsic Function

(links to explanatory section)

Suggested MPLAB XC8 Migration
__delay_cyclesUse the _delay_ms() or _delay_us() functions
__DES_decryptionNo simple migration recommended
__DES_encryptionNo simple migration recommended
__disable_interruptUse di() macro.
__enable_interruptUse the ei() macro.
__extended_load_program_memoryUse the address cast to a pointer and deferenced
__fractional_multiply_signedUse in-line assembly to insert the fmuls instruction
__fractional_multiply_signed_with_unsignedUse in-line assembly to insert the fmulsu instruction
__fractional_multiply_unsignedUse in-line assembly to insert the fmul instruction
__get_interrupt_stateUse in-line assembly to directly fetch the state of the register
__indirect_jump_toUse in-line assembly to insert the ijmp or eijmp instruction
__insert_opcodeUse in-line assembly to insert a .word directive
__lacUse in-line assembly to insert the lac instruction
__lasUse in-line assembly to insert the las instruction
__latUse in-line assembly to insert the lat instruction
__load_program_memoryThe address cast and dereferenced in C code
__multiply_signedUse in-line assembly to insert the muls instruction
__multiply_signed_with_unsignedUse in-line assembly to insert the mulsu instruction
__multiply_unsignedUse in-line assembly to insert the mul instruction
__no_operationUse the _NOP() macro.
__requireNo simple migration recommended
__restore_interruptUse plain C code to write the SREG register
__reverseNo simple migration recommended
__save_interruptPlain C code to copy the SREG register
__set_interrupt_stateUse in-line assembly to directly set the state of the register
__sleepUse in-line assembly to insert the sleep instruction
__swap_nibblesNo simple migration recommended
__watchdog_resetUse in-line assembly to insert the wdr instruction
__xchUse in-line assembly to insert the xch instruction