cancel
Showing results for 
Search instead for 
Did you mean: 

Cortex-M4 DSP instruction

matic
Associate III
Posted on May 02, 2016 at 19:45

Hello!

I would like to ask, if anyone knows, if there is a DSP instruction for Cortex-M4, which would calculate x*x + y*y. I saw that there are some quite complex instruction which are intended for similar calculations, but didn't find one for exactly that calculation.

x and y represent SINE and COSINE values (signed integers, 16-bit variables are sufficient). I would like to calculate a square of amplitude (x*x + y*y) as fast as possible. 

Thanks in advance.

2 REPLIES 2
Posted on May 02, 2016 at 21:25

SMUAD

JW

[EDIT] Even if it's a single instruction, it won't necessarily help - it's a SIMD instruction and there might be no effective way to get the operands as SIMD. You might be better off having halfword-in-a-word operands, and use SMULBB then SMLABB.
matic
Associate III
Posted on May 03, 2016 at 23:01

Thanks Jan.

I tried with instruction SMLALD and it works quite well. Except that it has ''accumulate'' feature, which I don't need. I put my 2 16-bit variables into one 32-bit variable, yes.

I will try your suggestions, too.