Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 314 2012-2013 Microchip Technology Inc.
__builtin_mpy
Description: Computes a x b ; also prefetches data ready for a future MAC operation.
xptr may be null to signify no X prefetch to be performed, in which case the values of
xincr and xval are ignored, but required.
yptr may be null to signify no Y prefetch to be performed, in which case the values of
yincr and yval are ignored, but required.
xval and yval nominate the address of a C variable where the prefetched value will be
stored.
xincr and yincr may be the literal values: -6, -4, -2, 0, 2, 4, 6 or an integer value.
For example:
volatile register int result asm("A");
int *xmemory;
int *ymemory;
int xVal, yVal;
result = __builtin_mpy(xVal, yVal,
&xmemory, &xVal, 2,
&ymemory, &yVal, 2);
might generate:
mpy w4*w5, A, [w8]+=2, w4, [w10]+=2, w5
Prototype: int __builtin_mpy(int a, int b,
int **xptr, int *xval, int xincr,
int **yptr, int *yval, int yincr);
Argument: a Integer multiplicand.
b Integer multiplier.
xptr Integer pointer to pointer to x prefetch.
xval Integer pointer to value of x prefetch.
xincr Integer increment value of x prefetch.
yptr Integer pointer to pointer to y prefetch.
yval Integer pointer to value of y prefetch.
yincr Integer increment value of y prefetch.
AWB Integer pointer to accumulator selection.
Return Value: Returns the value of a x b.
Assembler Operator/
Machine Instruction:
mpy
Error Messages An error message will be displayed if:
the result is not an accumulator register
xval is a null value but xptr is not null
yval is a null value but yptr is not null
Protego_Release_01_05-Related-OEM-Documentation-MPLAB-XC16-C-Compiler.pdf