aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2015-08-03 18:08:58 -0700
committerSamuel Iglesias Gonsálvez <[email protected]>2016-05-10 11:25:07 +0200
commite83f51d54e9c3db11526b66a741352135eae6f52 (patch)
treeca93b01db5cea5c6da3768335f6be56a784b5f8c /src/mesa
parenta5d7e144eaf43fee37e6ff9e2de194407087632b (diff)
i965/fs: fix compares for doubles
The destination has to have the same source as the type, or else the simulator will complain. As a result, we need to emit a CMP that outputs a 64-bit wide result and then do a strided MOV to pick out the low 32 bits of each channel. v2: Use subscript() instead of stride() (Curro) Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index f07b38afeb3..3772ff623bb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -899,23 +899,51 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
}
case nir_op_flt:
+ case nir_op_fge:
+ case nir_op_feq:
+ case nir_op_fne: {
+ fs_reg dest = result;
+ if (nir_src_bit_size(instr->src[0].src) > 32) {
+ dest = bld.vgrf(BRW_REGISTER_TYPE_DF, 1);
+ }
+ brw_conditional_mod cond;
+ switch (instr->op) {
+ case nir_op_flt:
+ cond = BRW_CONDITIONAL_L;
+ break;
+ case nir_op_fge:
+ cond = BRW_CONDITIONAL_GE;
+ break;
+ case nir_op_feq:
+ cond = BRW_CONDITIONAL_Z;
+ break;
+ case nir_op_fne:
+ cond = BRW_CONDITIONAL_NZ;
+ break;
+ default:
+ unreachable("bad opcode");
+ }
+ bld.CMP(dest, op[0], op[1], cond);
+ if (nir_src_bit_size(instr->src[0].src) > 32) {
+ bld.MOV(result, subscript(dest, BRW_REGISTER_TYPE_UD, 0));
+ }
+ break;
+ }
+
case nir_op_ilt:
case nir_op_ult:
bld.CMP(result, op[0], op[1], BRW_CONDITIONAL_L);
break;
- case nir_op_fge:
case nir_op_ige:
case nir_op_uge:
bld.CMP(result, op[0], op[1], BRW_CONDITIONAL_GE);
break;
- case nir_op_feq:
case nir_op_ieq:
bld.CMP(result, op[0], op[1], BRW_CONDITIONAL_Z);
break;
- case nir_op_fne:
case nir_op_ine:
bld.CMP(result, op[0], op[1], BRW_CONDITIONAL_NZ);
break;