Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> --- src/compiler/nir/nir_constant_expressions.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py index e79590f8359..0b3da1b21ac 100644 --- a/src/compiler/nir/nir_constant_expressions.py +++ b/src/compiler/nir/nir_constant_expressions.py @@ -64,6 +64,7 @@ template = """\ #include "util/rounding.h" /* for _mesa_roundeven */ #include "util/half_float.h" #include "util/bigmath.h" +#include "util/double.h" #include "nir_constant_expressions.h" /** @@ -370,7 +371,11 @@ struct ${type}${width}_vec { ## Sanitize the C value to a proper NIR 0/-1 bool _dst_val.${get_const_field(output_type)}[_i] = -(int)dst; % elif output_type == "float16": - _dst_val.u16[_i] = _mesa_float_to_half(dst); + % if "rtz" in op.rounding_mode: + _dst_val.u16[_i] = _mesa_float_to_float16_rtz(dst); + % else: + _dst_val.u16[_i] = _mesa_float_to_float16_rtne(dst); + % endif % else: _dst_val.${get_const_field(output_type)}[_i] = dst; % endif @@ -414,7 +419,11 @@ struct ${type}${width}_vec { ## Sanitize the C value to a proper NIR 0/-1 bool _dst_val.${get_const_field(output_type)}[${k}] = -(int)dst.${"xyzw"[k]}; % elif output_type == "float16": - _dst_val.u16[${k}] = _mesa_float_to_half(dst.${"xyzw"[k]}); + % if "rtz" in op.rounding_mode: + _dst_val.u16[${k}] = _mesa_float_to_float16_rtz(dst.${"xyzw"[k]}); + % else: + _dst_val.u16[${k}] = _mesa_float_to_float16_rtne(dst.${"xyzw"[k]}); + % endif % else: _dst_val.${get_const_field(output_type)}[${k}] = dst.${"xyzw"[k]}; % endif -- 2.19.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev