nir: add new mediump opcodes f2[ui]mp, i2fmp, u2fmp

Algebraic optimizations will select them.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>
This commit is contained in:
Marek Olšák
2020-09-03 23:47:32 -04:00
committed by Marge Bot
parent 385b4dbc39
commit cdd498bbe8
3 changed files with 12 additions and 0 deletions

View File

@@ -275,6 +275,10 @@ for src_t in [tint, tuint, tfloat, tbool]:
unop_numeric_convert("f2fmp", tfloat16, tfloat32, opcodes["f2f16"].const_expr)
unop_numeric_convert("i2imp", tint16, tint32, opcodes["i2i16"].const_expr)
# u2ump isn't defined, because the behavior is equal to i2imp
unop_numeric_convert("f2imp", tint16, tfloat32, opcodes["f2i16"].const_expr)
unop_numeric_convert("f2ump", tuint16, tfloat32, opcodes["f2u16"].const_expr)
unop_numeric_convert("i2fmp", tfloat16, tint32, opcodes["i2f16"].const_expr)
unop_numeric_convert("u2fmp", tfloat16, tuint32, opcodes["u2f16"].const_expr)
# Unary floating-point rounding operations.

View File

@@ -2068,8 +2068,12 @@ late_optimizations = [
# any conversions that could have been removed will have been removed in
# nir_opt_algebraic so any remaining ones are required.
(('f2fmp', a), ('f2f16', a)),
(('f2imp', a), ('f2i16', a)),
(('f2ump', a), ('f2u16', a)),
(('i2imp', a), ('i2i16', a)),
(('i2fmp', a), ('i2f16', a)),
(('i2imp', a), ('u2u16', a)),
(('u2fmp', a), ('u2f16', a)),
# Section 8.8 (Integer Functions) of the GLSL 4.60 spec says:
#