[Mesa-dev] [PATCH 23/45] i965/fs: Enable rounding mode on f2f16 ops

Alejandro Piñeiro apinheiro at igalia.com
Thu Jul 13 14:35:27 UTC 2017


By default we don't set the rounding mode. We only set
round-to-near-even or round-to-zero mode if explicitly set from nir.

Signed-off-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
---
 src/intel/compiler/brw_fs_nir.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index bc1bee6..7792e01 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -715,6 +715,14 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
       inst->saturate = instr->dest.saturate;
       break;
 
+   case nir_op_f2f16_rtne:
+   case nir_op_f2f16_rtz:
+      if (instr->op == nir_op_f2f16_rtz)
+         bld.emit(SHADER_OPCODE_RND_MODE_RTZ);
+      else if (instr->op == nir_op_f2f16_rtne)
+         bld.emit(SHADER_OPCODE_RND_MODE_RTE);
+      /* fallthrough */
+
    case nir_op_f2f16:
       /* In theory, it would be better to use BRW_OPCODE_F32TO16. Depending
        * on the HW gen, it is a special hw opcode or just a MOV, and
-- 
2.9.3



More information about the mesa-dev mailing list