pan/bi: Add dummy carry/borrow argument for iadd/isub
On FMA, a carry/borrow is required for iaddc/isubb (whereas the ADD
counterparts don't support carrying/borrowing). The trick is to model
this with an extra dummy (ZERO) argument which is free to encode on FMA,
and in the scheduler, "demote" to the non-carried versions if we want to
schedule to ADD.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 413c8d3..d4acad7 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -805,9 +805,13 @@
break;
case nir_op_iadd:
alu.op.imath = BI_IMATH_ADD;
+ /* Carry */
+ alu.src[2] = BIR_INDEX_ZERO;
break;
case nir_op_isub:
alu.op.imath = BI_IMATH_SUB;
+ /* Borrow */
+ alu.src[2] = BIR_INDEX_ZERO;
break;
case nir_op_iabs:
alu.op.special = BI_SPECIAL_IABS;