This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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
  • Thank you all for your help!

    I found out that I don't make any improvement using PKHBT and SMUAD instructions. Actually, if I do standard multiplication and addition (x2 + y2), it also takes only 2 instructions (with optimization level 3), because it compiles to one MUL and another MLA instruction.

    However, I will be more attentive to those instructions in the future, because they might be helpful some day.

    Best regards,

    Matic

Reply
  • Thank you all for your help!

    I found out that I don't make any improvement using PKHBT and SMUAD instructions. Actually, if I do standard multiplication and addition (x2 + y2), it also takes only 2 instructions (with optimization level 3), because it compiles to one MUL and another MLA instruction.

    However, I will be more attentive to those instructions in the future, because they might be helpful some day.

    Best regards,

    Matic

Children