5.7 __fractional_multiply_signed Intrinsic Function
The IAR __fractional_multiply_signed
intrinsic function generates an
fmuls
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 fmuls
instruction.
Caveats
None
Examples
Consider migrating IAR code such
as:
char x, y;
int z;
void foo(void) {
z = __fractional_multiply_signed(x, y);
}
to
MPLAB XC8 code similar
to:#include <xc.h>
int avr_fmuls(char x, char y)
{
int z;
__asm__("fmuls %1, %2 \n\t"
"movw %0, r0 \n\t"
"clr __zero_reg__ \n\t"
: "=r" (z)
: "a" (x), "a" (y));
return z;
}
char x, y;
int z;
void foo(void) {
z = avr_fmuls(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.