DSP instruction for x*x + y*y. Does it exist?

Hello all!

I am new to ARM community and this is my first question here. I work on embedded systems where we use Cortex-M4 based MCUs (concretely STM32F3 series). I would like to ask, if there is a DSP instruction which would calculate x*x + y*y.

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).

Thanks in advance.

Parents
  • Hi.

    I would have another question regarding these DSP instructions.

    What is their real advantage? I mean, if I calculate x*x + y*y using SMUAD instruction, I first had to format the 32-bit register with (x << 16) | y. Now, I have three instructions (<<, | and SMUAD). If I do a simple calculation with two multiplication and one addition (x*x + y*y), I also have three instructions. I know that I will not gain a huge amount of time with these few instructions, but I am curious when they become preferred over normal calculation. In my case there is no advantage of using it at all.

    Thanks

Reply
  • Hi.

    I would have another question regarding these DSP instructions.

    What is their real advantage? I mean, if I calculate x*x + y*y using SMUAD instruction, I first had to format the 32-bit register with (x << 16) | y. Now, I have three instructions (<<, | and SMUAD). If I do a simple calculation with two multiplication and one addition (x*x + y*y), I also have three instructions. I know that I will not gain a huge amount of time with these few instructions, but I am curious when they become preferred over normal calculation. In my case there is no advantage of using it at all.

    Thanks

Children
More questions in this forum