Commit 900ea2cb by Ben Clayton

SpirvShader: Implement GLSLstd450Cosh

Bug: b/126873455 Tests: dEQP-VK.glsl.builtin.precision.cosh.* Change-Id: I25b8d84bb8be76b816afade7c62e70fda2c926a0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28690Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 91fd0e2c
...@@ -3349,7 +3349,11 @@ namespace sw ...@@ -3349,7 +3349,11 @@ namespace sw
} }
case GLSLstd450Cosh: case GLSLstd450Cosh:
{ {
UNIMPLEMENTED("GLSLstd450Cosh"); auto val = GenericValue(this, routine, insn.word(5));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
dst.move(i, Cosh(val.Float(i)));
}
break; break;
} }
case GLSLstd450Tanh: case GLSLstd450Tanh:
......
...@@ -560,6 +560,7 @@ namespace rr ...@@ -560,6 +560,7 @@ namespace rr
func_.emplace("acosf", reinterpret_cast<void*>(acosf)); func_.emplace("acosf", reinterpret_cast<void*>(acosf));
func_.emplace("atanf", reinterpret_cast<void*>(atanf)); func_.emplace("atanf", reinterpret_cast<void*>(atanf));
func_.emplace("sinhf", reinterpret_cast<void*>(sinhf)); func_.emplace("sinhf", reinterpret_cast<void*>(sinhf));
func_.emplace("coshf", reinterpret_cast<void*>(coshf));
#ifdef __APPLE__ #ifdef __APPLE__
// LLVM uses this function on macOS for tan. // LLVM uses this function on macOS for tan.
...@@ -3126,6 +3127,11 @@ namespace rr ...@@ -3126,6 +3127,11 @@ namespace rr
return TransformFloat4PerElement(v, "sinhf"); return TransformFloat4PerElement(v, "sinhf");
} }
RValue<Float4> Cosh(RValue<Float4> v)
{
return TransformFloat4PerElement(v, "coshf");
}
Type *Float4::getType() Type *Float4::getType()
{ {
return T(llvm::VectorType::get(T(Float::getType()), 4)); return T(llvm::VectorType::get(T(Float::getType()), 4));
......
...@@ -2215,6 +2215,7 @@ namespace rr ...@@ -2215,6 +2215,7 @@ namespace rr
RValue<Float4> Acos(RValue<Float4> x); RValue<Float4> Acos(RValue<Float4> x);
RValue<Float4> Atan(RValue<Float4> x); RValue<Float4> Atan(RValue<Float4> x);
RValue<Float4> Sinh(RValue<Float4> x); RValue<Float4> Sinh(RValue<Float4> x);
RValue<Float4> Cosh(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