Mesa (master): i965/vec4-nir: Handle boolean resolvese on ILK-
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Mon Aug 10 18:46:42 UTC 2015
Module: Mesa
Branch: master
Commit: 5e1c1c2fcbdfb96a973ae3fd196e341ab2d41833
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e1c1c2fcbdfb96a973ae3fd196e341ab2d41833
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Mon Aug 3 10:00:38 2015 -0700
i965/vec4-nir: Handle boolean resolvese on ILK-
The analysis code was already there and running, we just weren't doing
anything with the result of it yet.
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index b13465b..3056d09 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -1292,6 +1292,20 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
default:
unreachable("Unimplemented ALU operation");
}
+
+ /* If we need to do a boolean resolve, replace the result with -(x & 1)
+ * to sign extend the low bit to 0/~0
+ */
+ if (devinfo->gen <= 5 &&
+ (instr->instr.pass_flags & BRW_NIR_BOOLEAN_MASK) ==
+ BRW_NIR_BOOLEAN_NEEDS_RESOLVE) {
+ dst_reg masked = dst_reg(this, glsl_type::int_type);
+ masked.writemask = dst.writemask;
+ emit(AND(masked, src_reg(dst), src_reg(1)));
+ src_reg masked_neg = src_reg(masked);
+ masked_neg.negate = true;
+ emit(MOV(retype(dst, BRW_REGISTER_TYPE_D), masked_neg));
+ }
}
void
More information about the mesa-commit
mailing list