SpirvShader: Implement GLSLstd450InverseSqrt

RcpSqrt_pp is not accurate enough to be used on non-relaxed precision types.

Bug: b/126873455
Tests: dEQP-VK.glsl.builtin.precision.inversesqrt.*
Change-Id: I3e34d28dbd863c9cb14cf6c79afe08a1992b5478
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28697
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index d1d416d..797ef73 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -3463,7 +3463,23 @@
 		}
 		case GLSLstd450InverseSqrt:
 		{
-			UNIMPLEMENTED("GLSLstd450InverseSqrt");
+			auto val = GenericValue(this, routine, insn.word(5));
+			Decorations d;
+			ApplyDecorationsForId(&d, insn.word(5));
+			if (d.RelaxedPrecision)
+			{
+				for (auto i = 0u; i < type.sizeInComponents; i++)
+				{
+					dst.move(i, RcpSqrt_pp(val.Float(i)));
+				}
+			}
+			else
+			{
+				for (auto i = 0u; i < type.sizeInComponents; i++)
+				{
+					dst.move(i, SIMD::Float(1.0f) / Sqrt(val.Float(i)));
+				}
+			}
 			break;
 		}
 		case GLSLstd450Determinant: