As I understand, _cmpy and _cmpyr functions use same inputs(i.e., packed 16 bit I and Q, in total a 32 bit value). The output of _cmpy will be 32bit I and 32 bit Q but output of _cmpyr will be 16 bit I and 16 bit Q, packed into 32 bits.
When I try complex multiplication with _cmpy, it works perfectly fine. But when I try _cmpyr(), the output is always zero or 0xFFFFFFFE. Please let me know if I am making any mistakes here in using the instruction.
Below is my sample code.
#include <stdio.h>
#include "c6x.h"
unsigned int i32Output = 0;
unsigned int i32Input1 = 0, i32Input2 = 0;
/* -50+23j * -63+54j */
signed short a = -50;
signed short b = 23;
signed short c = -63;
signed short d = 54;
void main()
{
memset(i32Output, 0, sizeof(i32Output));
i32Input1 |= a << 16;
i32Input1 |= b;
i32Input2 |= c << 16;
i32Input2 |= d;
i32Output = _cmpyr(i32Input1,i32Input2);
return;
}
CCS Version : 3.3.38.2
Thanks in advance.