Remove exp/log constant propagation TODOs
It's not feasible to propagate the constants that implement exp() using
exp2() and log() using log2(). The base-2 functions depend on the binary
representation of IEEE 754 floating-point numbers and the range
reductions depend on integer values for the exponent.
Bug: b/169754022
Change-Id: I4fe735abb7d56f3421510aa06ec9eb0205b9ccdf
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/63552
Reviewed-by: Sean Risser <srisser@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/ShaderCore.cpp b/src/Pipeline/ShaderCore.cpp
index 381521f..a3a9d6f 100644
--- a/src/Pipeline/ShaderCore.cpp
+++ b/src/Pipeline/ShaderCore.cpp
@@ -394,14 +394,12 @@
Float4 Exp(RValue<Float4> x)
{
- // TODO: Propagate the constant
- return sw::Exp2(Float4(1.44269504f) * x); // 1/ln(2)
+ return sw::Exp2(1.44269504f * x); // 1/ln(2)
}
Float4 Log(RValue<Float4> x)
{
- // TODO: Propagate the constant
- return Float4(6.93147181e-1f) * sw::Log2(x); // ln(2)
+ return 6.93147181e-1f * sw::Log2(x); // ln(2)
}
Float4 Pow(RValue<Float4> x, RValue<Float4> y)