SpirvShader: Implement GLSLstd450Acosh Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.acosh.* Change-Id: Id02fae0c7020ee83cb612f9370cdbb5c4dc31af1 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28693 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 d70e0ea..c630bfa 100644 --- a/src/Pipeline/SpirvShader.cpp +++ b/src/Pipeline/SpirvShader.cpp
@@ -3376,7 +3376,11 @@ } case GLSLstd450Acosh: { - UNIMPLEMENTED("GLSLstd450Acosh"); + auto val = GenericValue(this, routine, insn.word(5)); + for (auto i = 0u; i < type.sizeInComponents; i++) + { + dst.move(i, Acosh(val.Float(i))); + } break; } case GLSLstd450Atanh:
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index d105d3e..f31119e 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -563,6 +563,7 @@ func_.emplace("coshf", reinterpret_cast<void*>(coshf)); func_.emplace("tanhf", reinterpret_cast<void*>(tanhf)); func_.emplace("asinhf", reinterpret_cast<void*>(asinhf)); + func_.emplace("acoshf", reinterpret_cast<void*>(acoshf)); #ifdef __APPLE__ // LLVM uses this function on macOS for tan. @@ -3144,6 +3145,11 @@ return TransformFloat4PerElement(v, "asinhf"); } + RValue<Float4> Acosh(RValue<Float4> v) + { + return TransformFloat4PerElement(v, "acoshf"); + } + 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 ffbd7c8..7609307 100644 --- a/src/Reactor/Reactor.hpp +++ b/src/Reactor/Reactor.hpp
@@ -2218,6 +2218,7 @@ RValue<Float4> Cosh(RValue<Float4> x); RValue<Float4> Tanh(RValue<Float4> x); RValue<Float4> Asinh(RValue<Float4> x); + RValue<Float4> Acosh(RValue<Float4> x); template<class T> class Pointer : public LValue<Pointer<T>>