freedreno/ir3: Add ihadd/uhadd
authorRob Clark <robdclark@chromium.org>
Sun, 29 Aug 2021 15:39:39 +0000 (08:39 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 Oct 2021 18:59:57 +0000 (18:59 +0000)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13300>

src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_compiler_nir.c

index 58ddb4b..07cc651 100644 (file)
@@ -124,6 +124,8 @@ struct ir3_register {
       IR3_REG_BNOT = 0x400,
       /* (ei) flag, end-input?  Set on last bary, presumably to signal
        * that the shader needs no more input:
+       *
+       * Note: Has different meaning on other instructions like add.s/u
        */
       IR3_REG_EI = 0x2000,
       /* meta-flags, for intermediate stages of IR, ie.
index 7821f3e..56108ef 100644 (file)
@@ -553,6 +553,14 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu)
    case nir_op_iadd:
       dst[0] = ir3_ADD_U(b, src[0], 0, src[1], 0);
       break;
+   case nir_op_ihadd:
+      dst[0] = ir3_ADD_S(b, src[0], 0, src[1], 0);
+      dst[0]->dsts[0]->flags |= IR3_REG_EI;
+      break;
+   case nir_op_uhadd:
+      dst[0] = ir3_ADD_U(b, src[0], 0, src[1], 0);
+      dst[0]->dsts[0]->flags |= IR3_REG_EI;
+      break;
    case nir_op_iand:
       dst[0] = ir3_AND_B(b, src[0], 0, src[1], 0);
       break;