Commit 3928bd94 by Ben Clayton

SpirvShader: Implement GLSLstd450Tanh

Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.tanh.* Change-Id: If63f53b5d9d78dd4a2cd6c31c42cb16f03a48d98 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28691Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 900ea2cb
......@@ -3358,7 +3358,11 @@ namespace sw
}
case GLSLstd450Tanh:
{
UNIMPLEMENTED("GLSLstd450Tanh");
auto val = GenericValue(this, routine, insn.word(5));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, Tanh(val.Float(i)));
}
break;
}
case GLSLstd450Asinh:
......
......@@ -561,6 +561,7 @@ namespace rr
func_.emplace("atanf", reinterpret_cast<void*>(atanf));
func_.emplace("sinhf", reinterpret_cast<void*>(sinhf));
func_.emplace("coshf", reinterpret_cast<void*>(coshf));
func_.emplace("tanhf", reinterpret_cast<void*>(tanhf));
#ifdef __APPLE__
// LLVM uses this function on macOS for tan.
......@@ -3132,6 +3133,11 @@ namespace rr
return TransformFloat4PerElement(v, "coshf");
}
RValue<Float4> Tanh(RValue<Float4> v)
{
return TransformFloat4PerElement(v, "tanhf");
}
Type *Float4::getType()
{
return T(llvm::VectorType::get(T(Float::getType()), 4));
......
......@@ -2216,6 +2216,7 @@ namespace rr
RValue<Float4> Atan(RValue<Float4> x);
RValue<Float4> Sinh(RValue<Float4> x);
RValue<Float4> Cosh(RValue<Float4> x);
RValue<Float4> Tanh(RValue<Float4> x);
template<class T>
class Pointer : public LValue<Pointer<T>>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment