SpirvShader: Implement GLSLstd450Cos

Bug: b/126873455
Tests: dEQP-VK.glsl.builtin.precision.cos.*
Change-Id: I4b5fe36487f0832ad21f3e78df9ba133284cffbd
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28669
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index abe35df..578dfa1 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -555,6 +555,7 @@
 			func_.emplace("puts", reinterpret_cast<void*>(puts));
 			func_.emplace("fmodf", reinterpret_cast<void*>(fmodf));
 			func_.emplace("sinf", reinterpret_cast<void*>(sinf));
+			func_.emplace("cosf", reinterpret_cast<void*>(cosf));
 		}
 
 		void *findSymbol(const std::string &name) const
@@ -3070,6 +3071,12 @@
 		return RValue<Float4>(V(::builder->CreateCall(func, V(v.value))));
 	}
 
+	RValue<Float4> Cos(RValue<Float4> v)
+	{
+		auto func = llvm::Intrinsic::getDeclaration(::module, llvm::Intrinsic::cos, { V(v.value)->getType() } );
+		return RValue<Float4>(V(::builder->CreateCall(func, V(v.value))));
+	}
+
 	Type *Float4::getType()
 	{
 		return T(llvm::VectorType::get(T(Float::getType()), 4));