SpirvShader: Implement GLSLstd450Exp
Bug: b/126873455
Tests: dEQP-VK.glsl.builtin.precision.exp.*
Change-Id: I35a28475b56d820b6306782188d72a151845fe58
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28440
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/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index c04b300..e65f3fa 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -567,6 +567,7 @@
func_.emplace("atanhf", reinterpret_cast<void*>(atanhf));
func_.emplace("atan2f", reinterpret_cast<void*>(atan2f));
func_.emplace("powf", reinterpret_cast<void*>(powf));
+ func_.emplace("expf", reinterpret_cast<void*>(expf));
#ifdef __APPLE__
// LLVM uses this function on macOS for tan.
@@ -3182,6 +3183,12 @@
return RValue<Float4>(V(::builder->CreateCall(func, { V(x.value), V(y.value) })));
}
+ RValue<Float4> Exp(RValue<Float4> v)
+ {
+ auto func = llvm::Intrinsic::getDeclaration(::module, llvm::Intrinsic::exp, { T(Float4::getType()) } );
+ return RValue<Float4>(V(::builder->CreateCall(func, { V(v.value) })));
+ }
+
Type *Float4::getType()
{
return T(llvm::VectorType::get(T(Float::getType()), 4));