[Mesa-dev] [PATCH v3 38/44] i965/fs: set rounding mode when emitting affected conversion instructions

Samuel Iglesias Gonsálvez siglesias at igalia.com
Wed Feb 6 10:45:07 UTC 2019


Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 src/intel/compiler/brw_fs_nir.cpp | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 71e5a96e0a3..aab06a525bc 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -653,10 +653,15 @@ emit_find_msb_using_lzd(const fs_builder &bld,
 }
 
 static brw_rnd_mode
-brw_rnd_mode_from_nir_op (const nir_op op) {
+brw_rnd_mode_from_nir_op (const nir_op op)
+{
    switch (op) {
+   case nir_op_f2f64_rtz:
+   case nir_op_f2f32_rtz:
    case nir_op_f2f16_rtz:
       return BRW_RND_MODE_RTZ;
+   case nir_op_f2f64_rtne:
+   case nir_op_f2f32_rtne:
    case nir_op_f2f16_rtne:
       return BRW_RND_MODE_RTNE;
    default:
@@ -801,15 +806,11 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
    case nir_op_i2i64:
    case nir_op_u2f64:
    case nir_op_u2u64:
-   case nir_op_f2f64_rtne:
-   case nir_op_f2f64_rtz:
    case nir_op_f2f64:
    case nir_op_f2i64:
    case nir_op_f2u64:
    case nir_op_i2i32:
    case nir_op_u2u32:
-   case nir_op_f2f32_rtne:
-   case nir_op_f2f32_rtz:
    case nir_op_f2f32:
    case nir_op_f2i32:
    case nir_op_f2u32:
@@ -837,6 +838,17 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
       inst->saturate = instr->dest.saturate;
       break;
 
+   case nir_op_f2f64_rtne:
+   case nir_op_f2f64_rtz:
+   case nir_op_f2f32_rtne:
+   case nir_op_f2f32_rtz:
+      bld.emit(SHADER_OPCODE_RND_MODE, bld.null_reg_ud(),
+               brw_imm_d(brw_rnd_mode_from_nir_op(instr->op)));
+
+      inst = bld.MOV(result, op[0]);
+      inst->saturate = instr->dest.saturate;
+      break;
+
    case nir_op_fsign: {
       assert(!instr->dest.saturate);
       if (op[0].abs) {
-- 
2.19.1



More information about the mesa-dev mailing list