07.04.2013 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

16-Bit C <strong>Compiler</strong> User’s Guide<br />

__builtin_movsac<br />

Argument: xptr Integer pointer to pointer to x prefetch.<br />

xval Integer pointer to value of x prefetch.<br />

xincr Integer increment value of x prefetch.<br />

yptr Integer pointer to pointer to y prefetch.<br />

yval Integer pointer to value of y prefetch.<br />

yincr Integer increment value of y prefetch.<br />

AWB Integer pointer to accumulator selection.<br />

Return Value: Returns prefetch data.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

movsac<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_mpy<br />

Description: Computes a x b ; also prefetchs data ready <strong>for</strong> a future MAC 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 />

Prototype:<br />

might generate:<br />

mac w4*w5, A, [w8]+=2, w4, [w10]+=2, w5<br />

int __builtin_mpy(int a, int b,<br />

int **xptr, int *xval, int xincr,<br />

int **yptr, int *yval, int yincr);<br />

Argument: a Integer multiplic<strong>and</strong>.<br />

b Integer multiplier.<br />

xptr Integer pointer to pointer to x prefetch.<br />

xval Integer pointer to value of x prefetch.<br />

xincr Integer increment value of x prefetch.<br />

yptr Integer pointer to pointer to y prefetch.<br />

yval Integer pointer to value of y prefetch.<br />

yincr Integer increment value of y prefetch.<br />

AWB Integer pointer to accumulator selection.<br />

Return Value: Returns the cleared value result to an accumulator.<br />

Assembler Operator<br />

/ Machine<br />

Instruction:<br />

mpy<br />

DS51284G-page 152 © 2008 <strong>Microchip</strong> Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!