SpirvShader: Implement GLSLstd450Cosh

Bug: b/126873455
Tests: dEQP-VK.glsl.builtin.precision.cosh.*
Change-Id: I25b8d84bb8be76b816afade7c62e70fda2c926a0
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28690
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index e64ad7a..e33c382 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -3349,7 +3349,11 @@
 		}
 		case GLSLstd450Cosh:
 		{
-			UNIMPLEMENTED("GLSLstd450Cosh");
+			auto val = GenericValue(this, routine, insn.word(5));
+			for (auto i = 0u; i < type.sizeInComponents; i++)
+			{
+				dst.move(i, Cosh(val.Float(i)));
+			}
 			break;
 		}
 		case GLSLstd450Tanh:
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index a837ca5..d41cb0e 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -560,6 +560,7 @@
 			func_.emplace("acosf", reinterpret_cast<void*>(acosf));
 			func_.emplace("atanf", reinterpret_cast<void*>(atanf));
 			func_.emplace("sinhf", reinterpret_cast<void*>(sinhf));
+			func_.emplace("coshf", reinterpret_cast<void*>(coshf));
 
 #ifdef __APPLE__
 			// LLVM uses this function on macOS for tan.
@@ -3126,6 +3127,11 @@
 		return TransformFloat4PerElement(v, "sinhf");
 	}
 
+	RValue<Float4> Cosh(RValue<Float4> v)
+	{
+		return TransformFloat4PerElement(v, "coshf");
+	}
+
 	Type *Float4::getType()
 	{
 		return T(llvm::VectorType::get(T(Float::getType()), 4));
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index 4c0321b..99ee3bd 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -2215,6 +2215,7 @@
 	RValue<Float4> Acos(RValue<Float4> x);
 	RValue<Float4> Atan(RValue<Float4> x);
 	RValue<Float4> Sinh(RValue<Float4> x);
+	RValue<Float4> Cosh(RValue<Float4> x);
 
 	template<class T>
 	class Pointer : public LValue<Pointer<T>>