Skip to content

Remove parity branches from arm_sqrt_q15 - #339

Open
sylvesterkaczmarek wants to merge 1 commit into
ARM-software:mainfrom
sylvesterkaczmarek:perf/sqrt-q15-even-shift-9
Open

Remove parity branches from arm_sqrt_q15#339
sylvesterkaczmarek wants to merge 1 commit into
ARM-software:mainfrom
sylvesterkaczmarek:perf/sqrt-q15-even-shift-9

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

  • force the Q15 square-root normalization shift to an even value
  • replace the input-normalization parity branch with one shift
  • replace the output-rescaling parity branch with one shift
  • preserve the existing lookup table, Newton iterations, status values, and output values

Context

Issue #9 proposes two independent improvements to arm_sqrt_q15. One is to make the normalization shift even before it is used, which removes parity checks before and after the inverse-square-root calculation. The other is a wider internal format and new lookup table for greater precision.

This change implements only the branch-removal optimization. Rounding an odd normalization shift down to the preceding even value is exactly what both existing odd branches already do, so the numerical behavior remains unchanged.

This addresses the normalization-shift portion of #9.

Validation

  • git diff --check
  • compiled the original and patched implementations under separate symbols with GCC 13.3.0 and -Wall -Wextra -Werror
  • repeated the comparison at -O0 and -O3
  • exhaustively compared status and output for all 65,536 possible Q15 inputs; every result matched exactly

The full repository test suite was not run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant