Hello,
I'm looking to optimize my function by using intrinsics on C6678. (I have already done so with other functions so I'm familiar with the optimizations techniques for C6678)
As I use complex numbers I want to use the intrinsic _complex_mpysp
which is described as "double _complex_mpysp (double src1, double src2); Performs a complex multiply by performing a CMPYSP and DADDSP"
So here's the test I did (very simple) : (5 + 2i) * (3 - 4i) = 23 - 14i
However the result I get with the intrinsic is : -23 -14i
I've done similar tests with other numbers and the sign of the real part is always wrong !
Am I missing something ?
My config : CCS 5.1.1.00031 ; compiler 7.3.3 ; tested with or without optimization (O3) and with or without debug
Here's the code detail (simplified) :
// .buffer : > DDR3
#pragma DATA_SECTION(a,".buffer");#pragma DATA_SECTION(b,".buffer");#pragma DATA_SECTION(y,".buffer");
#pragma DATA_ALIGN(a, CACHE_L2_LINESIZE);#pragma DATA_ALIGN(b, CACHE_L2_LINESIZE);#pragma DATA_ALIGN(y, CACHE_L2_LINESIZE);
float a[2];float b[2];float y[2];
double a_cplx;double b_cplx;double result;
int address;
a[0] = 5;
a[1] = 2;
b[0] = 3;
b[1] = -4;
y[0] = 0;
y[1] = 0;
address = 0;
a_cplx = _amemd8((void*)&a[address]); // Load 2 floats (real part and imag part)
b_cplx = _amemd8((void*)&b[address]);
result = _complex_mpysp(a_cplx,b_cplx);
y[address] = _hif(result); // get the real part of the result
y[address+1] = _lof(result); // imag part
Thank you,
CM