intel/vec4: Fix nir_op_b2[fi] with 64-bit result
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 11 Oct 2018 03:04:17 +0000 (22:04 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 11 Oct 2018 20:21:19 +0000 (15:21 -0500)
This is valid NIR but you can't actually hit this case today.  GLSL IR
doesn't have a bool to double opcode; it does f2d(b2f(x)).  In SPIR-V we
don't have any to/from bool conversion opcodes at all.  However, the
next commit will make us start generating it so we should be ready.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/intel/compiler/brw_vec4_nir.cpp

index eaf1754b00674f96f4aa40eeb9effa83637a4a39..5ccfd1f8940a0a1f4135dd50a403e48df16d0346 100644 (file)
@@ -1586,7 +1586,12 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
 
    case nir_op_b2i:
    case nir_op_b2f:
-      emit(MOV(dst, negate(op[0])));
+      if (nir_dest_bit_size(instr->dest.dest) > 32) {
+         assert(dst.type == BRW_REGISTER_TYPE_DF);
+         emit_conversion_to_double(dst, negate(op[0]), false);
+      } else {
+         emit(MOV(dst, negate(op[0])));
+      }
       break;
 
    case nir_op_f2b: