[Mesa-dev] [PATCH v2 28/78] i965/nir/vec4: Implement single-element "mov" operations

Eduardo Lima Mitev elima at igalia.com
Thu Jul 23 03:17:08 PDT 2015


From: Antia Puentes <apuentes at igalia.com>

Adds NIR ALU operations:
   * nir_op_imov
   * nir_op_fmov
---
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 26bd996..9d1f32b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -658,6 +658,8 @@ brw_swizzle_for_nir_swizzle(uint8_t swizzle[4])
 void
 vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
 {
+   vec4_instruction *inst;
+
    dst_reg dst = get_nir_dest(instr->dest.dest,
                               nir_op_infos[instr->op].output_type);
    dst.writemask = instr->dest.write_mask;
@@ -670,6 +672,17 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
       op[i].abs = instr->src[i].abs;
       op[i].negate = instr->src[i].negate;
    }
+
+   switch (instr->op) {
+   case nir_op_imov:
+   case nir_op_fmov:
+      inst = emit(MOV(dst, op[0]));
+      inst->saturate = instr->dest.saturate;
+      break;
+
+   default:
+      unreachable("Unimplemented ALU operation");
+   }
 }
 
 void
-- 
2.1.4



More information about the mesa-dev mailing list