Re: Inline assembler - making sense of operands
Posted: Fri Jun 04, 2021 9:44 pm
Thanks akp, I'm doing that now and it's much simpler.
The community of XMOS. The place to be when developing with XMOS technology.
https://www.xcore.com:443/
The constraint "0" means this uses the same register as operand 0. Similar for "1".CousinItt wrote: ↑Tue Jun 01, 2021 11:04 am According to the xCore200 architecture document, maccs should take four operands, two of which are both inputs and outputs. However, in the snippet below, two constants appear as additional input parameters. What's going on here? Is this indicating to the compiler to insert additional instructions to load the constants into the registers? Is this explained in any documentation?
Code: Select all
int32_t dsp_filters_biquad ( int32_t input_sample, const int32_t* filter_coeffs, int32_t* state_data, const int32_t q_format ) { uint32_t al; int32_t ah, c1,c2, s1,s2; ... asm("maccs %0,%1,%2,%3":"=r"(ah),"=r"(al):"r"(input_sample),"r"(c1),"0"(0),"1"(1<<(q_format-1))); ... return ah; }
Code: Select all
ah = 0;
al = 1 << (q_format-1);
asm("maccs %0,%1,%2,%3" : "+r"(ah), "+r"(al) : "r"(input_sample), "r"(c1));