Mesa (master): nir: Add r600 specific sin and cos variants
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 22 14:59:19 UTC 2021
Module: Mesa
Branch: master
Commit: 318701b80399222457abd013bf797d744675ef58
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=318701b80399222457abd013bf797d744675ef58
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Wed Mar 10 09:43:48 2021 +0100
nir: Add r600 specific sin and cos variants
r600 expect the input values to be normalited by divinding by 2 *PI, so
add an opcode to be able to lower this in nir.
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9452>
---
src/compiler/nir/nir_opcodes.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index e9514e1bce2..6966eeda4be 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -1233,6 +1233,12 @@ unop_horiz("cube_r600", 4, tfloat32, 3, tfloat32, """
}
""")
+# r600 specific sin and cos
+# these trigeometric functions need some lowering because the supported
+# input values are expected to be normalized by dividing by (2 * pi)
+unop("fsin_r600", tfloat32, "sinf(6.2831853 * src0)")
+unop("fcos_r600", tfloat32, "cosf(6.2831853 * src0)")
+
# 24b multiply into 32b result (with sign extension)
binop("imul24", tint32, _2src_commutative + associative,
"(((int32_t)src0 << 8) >> 8) * (((int32_t)src1 << 8) >> 8)")
More information about the mesa-commit
mailing list