5.8 __fractional_multiply_signed_with_unsigned Intrinsic Function

The IAR __fractional_multiply_signed_with_unsigned intrinsic function generates an fmulsu instruction acting on the two arguments.

Suggested Replacement

There is no MPLAB XC8 equivalent built-in function; however, the instruction can be inserted explicitly using in-line assembly code.

Use in-line assembly to directly write an fmulsu instruction.

Caveats

None

Examples

Consider migrating IAR code such as:
signed char x = 0x10;
unsigned char y = 0x20;
int z;
void foo(void) {
    z = __fractional_multiply_signed_with_unsigned(x, y);
}
to MPLAB XC8 code similar to:
#include <xc.h>

int avr_fmulsu(char x, unsigned char y)
{
  int z;
  __asm__("fmulsu %1, %2      \n\t"
          "movw %0, r0       \n\t"
          "clr __zero_reg__  \n\t"
          : "=r" (z)
          : "a" (x), "a" (y));
  return z;
}

signed char x = 0x10;
unsigned char y = 0x20;
int z;
void foo(void) {
    z = avr_fmulsu(x, y);
}

Further Information

See the In-line Assembly section in the MPLAB XC8 C Compiler User's Guide for AVR MCUs for more information on adding in-line assembly.