28.2.9 __builtin_clr_prefetch
Description
Clear an accumulator and prefetch 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.
If AWB
is non null, the other accumulator will be written back
into the referenced variable.
For example:
volatile register int16_t result asm("A");
volatile register int16_t B asm("B");
int16_t x_memory_buffer[256] __attribute__((space(xmemory)));
int16_t y_memory_buffer[256] __attribute__((space(ymemory)));
int16_t *xmemory;
int16_t *ymemory;
int16_t awb;
int16_t xVal, yVal;
xmemory = x_memory_buffer;
ymemory = y_memory_buffer;
result = __builtin_clr(&xmemory, &xVal, 2,
&ymemory, &yVal, 2, &awb, B);
might generate:
clr A, [w8]+=2, w4, [w10]+=2, w5, w13
The compiler may need to spill w13 to ensure that it is available for the write-back. It may be recommended to users that the register be claimed for this purpose.
After this instruction:
result will be cleared
xVal
will contain x_memory_buffer[0]
yVal
will contain y_memory_buffer[0]
xmemory
and ymemory
will be incremented by 2, ready for
the next mac operation
Prototype
int16_t __builtin_clr_prefetch(
int16_t **xptr, int16_t *xval, int16_t xincr,
int16_t **yptr, int16_t *yval, int16_t yincr,
int16_t *AWB, int16_t AWB_accum);
Arguments
xptr
– Integer pointer to x prefetch
xval
– Integer value of x prefetch
xincr
– Integer increment value of x prefetch
yptr
– Integer pointer to y prefetch
yval
– Integer value of y prefetch
yincr
– Integer increment value of y prefetch
AWB
– Accumulator write back location
AWB_accum
– Accumulator to write back
Return Value
Returns the cleared value result to an accumulator.
Machine Instruction
clr
Error Messages
An error message will be displayed if:
- the result is not an accumulator register
xval
is a null value butxptr
is not nullyval
is a null value butyptr
is not nullAWB_accum
is not an accumulator andAWB
is not null