MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
__builtin_mpy<br />
Error Messages An error message will be displayed if:<br />
• the result is not an accumulator register<br />
• xval is a null value but xptr is not null<br />
• yval is a null value but yptr is not null<br />
__builtin_mpyn<br />
Built-in Functions<br />
Description: Computes -a x b ; also prefetchs data ready <strong>for</strong> a future MAC<br />
operation.<br />
xptr may be null to signify no X prefetch to be per<strong>for</strong>med, in which<br />
case the values of xincr <strong>and</strong> xval are ignored, but required.<br />
yptr may be null to signify no Y prefetch to be per<strong>for</strong>med, in which<br />
case the values of yincr <strong>and</strong> yval are ignored, but required.<br />
xval <strong>and</strong> yval nominate the address of a C variable where the<br />
prefetched value will be stored.<br />
xincr <strong>and</strong> yincr may be the literal values: -6, -4, -2, 0, 2, 4, 6 or an<br />
integer value.<br />
For example:<br />
register int result asm("A");<br />
int *xmemory;<br />
int *ymemory;<br />
int xVal, yVal;<br />
result = __builtin_mpy(xVal, yVal,<br />
&xmemory, &xVal, 2,<br />
&ymemory, &yVal, 2);<br />
might generate:<br />
mac w4*w5, A, [w8]+=2, w4, [w10]+=2, w5<br />
Prototype: int __builtin_mpyn(int a, int b,<br />
int **xptr, int *xval, int xincr,<br />
int **yptr, int *yval, int yincr);<br />
Argument: aInteger multiplic<strong>and</strong>.<br />
bInteger multiplier.<br />
xptrInteger pointer to pointer to x prefetch.<br />
xvalInteger pointer to value of x prefetch.<br />
xincrInteger increment value of x prefetch.<br />
yptrInteger pointer to pointer to y prefetch.<br />
yvalInteger pointer to value of y prefetch.<br />
yincrInteger increment value of y prefetch.<br />
AWBInteger pointer to accumulator selection.<br />
Return Value: Returns the cleared value result to an accumulator.<br />
Assembler Opera- mpyn<br />
tor / Machine<br />
Instruction:<br />
Error Messages An error message will be displayed if:<br />
• the result is not an accumulator register<br />
• xval is a null value but xptr is not null<br />
• yval is a null value but yptr is not null<br />
© 2008 <strong>Microchip</strong> Technology Inc. DS51284G-page 153