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

Loss of information - SMMUL

Why the Cortex M4 instruction SMMUL (32 = 32 x 32b) preserves a redundant sign bit and discards one useful bit of information? What could possibly be the justification for such blatant disregard of the ISO/IEC TR 18037 standard Fract format?

Parents Reply Children
  • By the way some of the Cortex-M4 processors have single precision floating point and that is quite quick.

    I just had a look at what gcc does for this and it doesn't do saturation. It could do the work in the same time and saturation I think with

    smull hi, lo, x, y

    lsr lo,31

    qdadd result,lo,hi

  • Yes, your code example corresponds to the saturated multiplication that I have been using. It takes 3 cycles to complete. The single precision floating point is faster (VMUL.F32 takes 1 cycle) but the 24-bit mantissa has lower resolution than the 32-bit Fract so it can't be considered a direct replacement.

  • daith, sorry if I posted that. I didn't have much time and about to log-out then but there was a young engineer (I've recently convinced to also study ARM instead of being too dedicated to AVR and PICmicro) who read your reply pertaining to SMULL/SMMUL and wondered if SMULL was excluded in Cortex-M4. I then decided to post such response, hoping that would help prevent some other readers, especially new users of Cortex-M, from also misinterpreting the info.

  • I was agreeing with you. Misinterpreting happens all the time and is very hard to guard against.