Re:Did any processor implement an integer square root instru...
by voidbert on Sunday April 07, 2024 @12:42PM
(#39961911)
What task benefits from using such a complex instruction so easily dividable in simpler ones for it to be present in aarch64?
Re:Did any processor implement an integer square root instru...
by nanidin on Sunday April 07, 2024 @12:45PM
(#39961944)
Neon is SIMD so I would presume these instructions let you vectorize those calculations and do them in parallel on a lot of data more efficiently than if you broke it down into simpler operations and did them one by one.
Re:Did any processor implement an integer square root instru...
by voidbert on Sunday April 07, 2024 @01:18PM
(#39962180)
Yes, but the part that got me was the halving of the result followed by the clamping. SIMD generally makes sense, but for something like this to exist usually there's something very specific (like a certain video codec, for example) that greatly benefits from such a complex instruction.
Re:Did any processor implement an integer square root instru...
by creato on Sunday April 07, 2024 @01:23PM
(#39962220)
It's probably not about avoiding extra instructions/performance, but making the range of the result more useful and avoiding overflow. Or in other words, the entire instruction may be useless if you don't do these things.
Re:Did any processor implement an integer square root instru...
by epcoa on Sunday April 07, 2024 @05:30PM
(#39964114)
The halving and clamping is nothing particularly remarkable in the context of usefully using fixed point numbers (scaled integers) to avoid overflow. Reciprocal square root itself is a fundamental operation for DSP algorithms and of course computer graphics.
This is a fairly generic instruction really, though FRSQRTE likely gets more real world use.
Re:Did any processor implement an integer square root instru...
by ekelsen on Sunday April 07, 2024 @11:09PM
(#39965890)
The halving could come from an intended use in a Newton Raphson iteration of a square root refinement.
See for example https://math.mit.edu/~stevenj/18.335/newton-sqrt.pdf
The initial guess is the approximate square root, but it needs to be halved as part of the calculation.
Re:Did any processor implement an integer square root instru...
by colechristensen on Sunday April 07, 2024 @12:54PM
(#39962022)
Inverse square root is for normalizing vectors particularly in computer graphics calculations, it needs to be run a whole lot very fast.
https://en.m.wikipedia.org/wiki/Fast_inverse_square_root#Mot...
The related FRSQRTE instruction is much more conventional, operating on 32-bit floats, again giving approximate inverse square root.