bool use_mod = false;
unsigned mod;
- if (offset_nir_src->is_ssa) {
- /* Try to calculate the value of (offset + base) % 4. If we can do
- * this, then we can do indirect writes using only 1 URB write.
- */
- use_mod = nir_mod_analysis(nir_get_ssa_scalar(offset_nir_src->ssa, 0), nir_type_uint, 4, &mod);
- if (use_mod) {
- mod += nir_intrinsic_base(instr) + component_from_intrinsic(instr);
- mod %= 4;
- }
+ /* Try to calculate the value of (offset + base) % 4. If we can do
+ * this, then we can do indirect writes using only 1 URB write.
+ */
+ use_mod = nir_mod_analysis(nir_get_ssa_scalar(offset_nir_src->ssa, 0), nir_type_uint, 4, &mod);
+ if (use_mod) {
+ mod += nir_intrinsic_base(instr) + component_from_intrinsic(instr);
+ mod %= 4;
}
if (use_mod) {
static uint8_t
get_resolve_status_for_src(nir_src *src)
{
- if (src->is_ssa) {
- nir_instr *src_instr = src->ssa->parent_instr;
- uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
+ nir_instr *src_instr = src->ssa->parent_instr;
+ uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
- /* If the source instruction needs resolve, then from the perspective
- * of the user, it's a true boolean.
- */
- if (resolve_status == BRW_NIR_BOOLEAN_NEEDS_RESOLVE)
- resolve_status = BRW_NIR_BOOLEAN_NO_RESOLVE;
- return resolve_status;
- } else {
- return BRW_NIR_NON_BOOLEAN;
- }
+ /* If the source instruction needs resolve, then from the perspective
+ * of the user, it's a true boolean.
+ */
+ if (resolve_status == BRW_NIR_BOOLEAN_NEEDS_RESOLVE)
+ resolve_status = BRW_NIR_BOOLEAN_NO_RESOLVE;
+ return resolve_status;
}
/** Marks the given source as needing a resolve
static bool
src_mark_needs_resolve(nir_src *src, void *void_state)
{
- if (src->is_ssa) {
- nir_instr *src_instr = src->ssa->parent_instr;
- uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
-
- /* If the source instruction is unresolved, then mark it as needing
- * to be resolved.
- */
- if (resolve_status == BRW_NIR_BOOLEAN_UNRESOLVED) {
- src_instr->pass_flags &= ~BRW_NIR_BOOLEAN_MASK;
- src_instr->pass_flags |= BRW_NIR_BOOLEAN_NEEDS_RESOLVE;
- }
+ nir_instr *src_instr = src->ssa->parent_instr;
+ uint8_t resolve_status = src_instr->pass_flags & BRW_NIR_BOOLEAN_MASK;
+ /* If the source instruction is unresolved, then mark it as needing
+ * to be resolved.
+ */
+ if (resolve_status == BRW_NIR_BOOLEAN_UNRESOLVED) {
+ src_instr->pass_flags &= ~BRW_NIR_BOOLEAN_MASK;
+ src_instr->pass_flags |= BRW_NIR_BOOLEAN_NEEDS_RESOLVE;
}
return true;
}
}
- /* If the destination is SSA, go ahead allow unresolved booleans.
- * If the destination register doesn't have a well-defined parent_instr
- * we need to resolve immediately.
- */
- if (!alu->dest.dest.is_ssa &&
- resolve_status == BRW_NIR_BOOLEAN_UNRESOLVED) {
- resolve_status = BRW_NIR_BOOLEAN_NEEDS_RESOLVE;
- }
-
+ /* Go ahead allow unresolved booleans. */
instr->pass_flags = (instr->pass_flags & ~BRW_NIR_BOOLEAN_MASK) |
resolve_status;
vec4_visitor::optimize_predicate(nir_alu_instr *instr,
enum brw_predicate *predicate)
{
- if (!instr->src[0].src.is_ssa ||
- instr->src[0].src.ssa->parent_instr->type != nir_instr_type_alu)
+ if (instr->src[0].src.ssa->parent_instr->type != nir_instr_type_alu)
return false;
nir_alu_instr *cmp_instr =
case nir_op_fceil: {
src_reg tmp = src_reg(this, glsl_type::float_type);
- tmp.swizzle =
- brw_swizzle_for_size(instr->src[0].src.is_ssa ?
- instr->src[0].src.ssa->num_components :
- instr->src[0].src.reg.reg->num_components);
+ tmp.swizzle = brw_swizzle_for_size(nir_src_num_components(instr->src[0].src));
op[0].negate = !op[0].negate;
emit(RNDD(dst_reg(tmp), op[0]));