Commit fa6a539a by Ben Clayton

SpirvShader: Implement GLSLstd450Atanh

Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.atanh.* Change-Id: Ie58753a4a0bdef18ec317129f2c4a7f0c0c314b4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28694Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 28ebcb01
...@@ -3385,7 +3385,11 @@ namespace sw ...@@ -3385,7 +3385,11 @@ namespace sw
} }
case GLSLstd450Atanh: case GLSLstd450Atanh:
{ {
UNIMPLEMENTED("GLSLstd450Atanh"); auto val = GenericValue(this, routine, insn.word(5));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, Atanh(val.Float(i)));
}
break; break;
} }
case GLSLstd450Atan2: case GLSLstd450Atan2:
......
...@@ -564,6 +564,7 @@ namespace rr ...@@ -564,6 +564,7 @@ namespace rr
func_.emplace("tanhf", reinterpret_cast<void*>(tanhf)); func_.emplace("tanhf", reinterpret_cast<void*>(tanhf));
func_.emplace("asinhf", reinterpret_cast<void*>(asinhf)); func_.emplace("asinhf", reinterpret_cast<void*>(asinhf));
func_.emplace("acoshf", reinterpret_cast<void*>(acoshf)); func_.emplace("acoshf", reinterpret_cast<void*>(acoshf));
func_.emplace("atanhf", reinterpret_cast<void*>(atanhf));
#ifdef __APPLE__ #ifdef __APPLE__
// LLVM uses this function on macOS for tan. // LLVM uses this function on macOS for tan.
...@@ -3150,6 +3151,11 @@ namespace rr ...@@ -3150,6 +3151,11 @@ namespace rr
return TransformFloat4PerElement(v, "acoshf"); return TransformFloat4PerElement(v, "acoshf");
} }
RValue<Float4> Atanh(RValue<Float4> v)
{
return TransformFloat4PerElement(v, "atanhf");
}
Type *Float4::getType() Type *Float4::getType()
{ {
return T(llvm::VectorType::get(T(Float::getType()), 4)); return T(llvm::VectorType::get(T(Float::getType()), 4));
......
...@@ -2219,6 +2219,7 @@ namespace rr ...@@ -2219,6 +2219,7 @@ namespace rr
RValue<Float4> Tanh(RValue<Float4> x); RValue<Float4> Tanh(RValue<Float4> x);
RValue<Float4> Asinh(RValue<Float4> x); RValue<Float4> Asinh(RValue<Float4> x);
RValue<Float4> Acosh(RValue<Float4> x); RValue<Float4> Acosh(RValue<Float4> x);
RValue<Float4> Atanh(RValue<Float4> x);
template<class T> template<class T>
class Pointer : public LValue<Pointer<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