jay: fix bfn cmod

affects dEQP-GLES31.functional.compute.basic.image_atomic_op_local_size_8

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40960>
This commit is contained in:
Alyssa Rosenzweig 2026-04-14 11:58:43 -04:00 committed by Marge Bot
parent b9f8467855
commit 9df62df55e
3 changed files with 29 additions and 2 deletions

View file

@ -42,6 +42,15 @@ propagate_cmod(jay_function *func, jay_inst *I, jay_inst **defs)
if (!def || !jay_is_null(def->cond_flag) || !jay_opcode_infos[def->op].cmod)
return false;
/* bfn bspec says "only zero(ze), greater-than(gt), and less-than(lt)
* conditional modifiers are valid."
*/
if (def->op == JAY_OPCODE_BFN && !(cmod == JAY_CONDITIONAL_EQ ||
cmod == JAY_CONDITIONAL_GT ||
cmod == JAY_CONDITIONAL_LT)) {
return false;
}
/* "Neither Saturate nor conditional modifier allowed with DW integer
* multiply."
*

View file

@ -504,7 +504,18 @@ emit(struct brw_codegen *p,
}
if (cmod != BRW_CONDITIONAL_NONE) {
brw_eu_inst_set_cond_modifier(p->devinfo, brw_eu_last_inst(p), cmod);
if (I->op != JAY_OPCODE_BFN) {
brw_eu_inst_set_cond_modifier(p->devinfo, brw_eu_last_inst(p), cmod);
} else {
unsigned cc = cmod == BRW_CONDITIONAL_L ? 3 :
cmod == BRW_CONDITIONAL_G ? 2 :
cmod == BRW_CONDITIONAL_Z ? 1 :
cmod == BRW_CONDITIONAL_NONE ? 0 :
-1;
assert(cc < 4 && "invalid cmod for bfn");
brw_eu_inst_set_boolean_func_cond_modifier(p->devinfo,
brw_eu_last_inst(p), cc);
}
}
assert(p->nr_insn == (nr_ins_before + jay_macro_length(I)) &&

View file

@ -251,7 +251,14 @@ TEST_F(Optimizer, TypeNeutralConditionalMods)
jay_def flag = jay_alloc_def(b, FLAG, 1);
jay_def x = jay_alloc_def(b, GPR, 1);
jay_inst *bfn3 = jay_BFN(b, x, wx, wy, wz, UTIL_LUT3(a & b & c));
jay_set_conditional_mod(b, bfn3, flag, mods[i]);
/* BFN.ne is not permitted & should not be propagated */
if (mods[i] == JAY_CONDITIONAL_EQ) {
jay_set_conditional_mod(b, bfn3, flag, mods[i]);
} else {
jay_CMP(b, JAY_TYPE_S32, mods[i], flag, x, 0);
}
jay_SEL(b, JAY_TYPE_U32, out, x, 123, flag);
});