diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 88162ecc86e..4c6770e7719 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -490,6 +490,18 @@ bi_can_iaddc(bi_instr *ins) ins->src[1].swizzle == BI_SWIZZLE_H01); } +/* + * The encoding of *FADD.v2f16 only specifies a single abs flag. All abs + * encodings are permitted by swapping operands; however, this scheme fails if + * both operands are equal. Test for this case. + */ +static bool +bi_impacted_abs(bi_instr *I) +{ + return I->src[0].abs && I->src[1].abs && + bi_is_word_equiv(I->src[0], I->src[1]); +} + bool bi_can_fma(bi_instr *ins) { @@ -497,6 +509,10 @@ bi_can_fma(bi_instr *ins) if (bi_can_iaddc(ins)) return true; + /* *FADD.v2f16 has restricted abs modifiers, use +FADD.v2f16 instead */ + if (ins->op == BI_OPCODE_FADD_V2F16 && bi_impacted_abs(ins)) + return false; + /* TODO: some additional fp16 constraints */ return bi_opcode_props[ins->op].fma; }