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@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9452>
This commit is contained in:
Gert Wollny 2021-03-10 09:43:48 +01:00
parent 0f5b3c37c5
commit 318701b803
1 changed files with 6 additions and 0 deletions

View File

@ -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)")