SpirvShader: Implement GLSLstd450Sinh Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.sinh.* Change-Id: I59239dd0623260090ac662501bdefb2da273fd97 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28688 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 14fcc0a..aabfb82 100644 --- a/src/Pipeline/SpirvShader.cpp +++ b/src/Pipeline/SpirvShader.cpp
@@ -3338,6 +3338,15 @@ } break; } + case GLSLstd450Sinh: + { + auto val = GenericValue(this, routine, insn.word(5)); + for (auto i = 0u; i < type.sizeInComponents; i++) + { + dst.move(i, Sinh(val.Float(i))); + } + break; + } default: UNIMPLEMENTED("Unhandled ExtInst %d", extInstIndex);
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index 5a3f5f6..a837ca5 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -559,6 +559,7 @@ func_.emplace("asinf", reinterpret_cast<void*>(asinf)); func_.emplace("acosf", reinterpret_cast<void*>(acosf)); func_.emplace("atanf", reinterpret_cast<void*>(atanf)); + func_.emplace("sinhf", reinterpret_cast<void*>(sinhf)); #ifdef __APPLE__ // LLVM uses this function on macOS for tan. @@ -3120,6 +3121,11 @@ return TransformFloat4PerElement(v, "atanf"); } + RValue<Float4> Sinh(RValue<Float4> v) + { + return TransformFloat4PerElement(v, "sinhf"); + } + 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 d9eb3e6..4c0321b 100644 --- a/src/Reactor/Reactor.hpp +++ b/src/Reactor/Reactor.hpp
@@ -2214,6 +2214,7 @@ RValue<Float4> Asin(RValue<Float4> x); RValue<Float4> Acos(RValue<Float4> x); RValue<Float4> Atan(RValue<Float4> x); + RValue<Float4> Sinh(RValue<Float4> x); template<class T> class Pointer : public LValue<Pointer<T>>