vc4: Add QIR/QPU support for the 8-bit vector instructions.
authorEric Anholt <eric@anholt.net>
Fri, 9 Jan 2015 02:07:15 +0000 (18:07 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 23 Oct 2015 17:11:21 +0000 (18:11 +0100)
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_qir.c
src/gallium/drivers/vc4/vc4_qir.h
src/gallium/drivers/vc4/vc4_qpu_emit.c

index b931870ae2da2615b45b93bb1c0bebc0e75f39f2..5d7564b46d58091f86e326ae4dcb3d92a4cc6aa9 100644 (file)
@@ -1040,6 +1040,26 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
                 *dest = ntq_emit_ubfe(c, src[0], src[1], src[2]);
                 break;
 
+        case nir_op_usadd_4x8:
+                *dest = qir_V8ADDS(c, src[0], src[1]);
+                break;
+
+        case nir_op_ussub_4x8:
+                *dest = qir_V8SUBS(c, src[0], src[1]);
+                break;
+
+        case nir_op_umin_4x8:
+                *dest = qir_V8MIN(c, src[0], src[1]);
+                break;
+
+        case nir_op_umax_4x8:
+                *dest = qir_V8MAX(c, src[0], src[1]);
+                break;
+
+        case nir_op_umul_unorm_4x8:
+                *dest = qir_V8MULD(c, src[0], src[1]);
+                break;
+
         default:
                 fprintf(stderr, "unknown NIR ALU inst: ");
                 nir_print_instr(&instr->instr, stderr);
index d7da63ba207f5cc65b837f02ec396b58ef54a14a..e7d0d664e19813858643f65073b3ed1a06f05ce4 100644 (file)
@@ -40,6 +40,11 @@ static const struct qir_op_info qir_op_info[] = {
         [QOP_FSUB] = { "fsub", 1, 2 },
         [QOP_FMUL] = { "fmul", 1, 2 },
         [QOP_MUL24] = { "mul24", 1, 2 },
+        [QOP_V8MULD] = {"v8muld", 1, 2 },
+        [QOP_V8MIN] = {"v8min", 1, 2 },
+        [QOP_V8MAX] = {"v8max", 1, 2 },
+        [QOP_V8ADDS] = {"v8adds", 1, 2 },
+        [QOP_V8SUBS] = {"v8subs", 1, 2 },
         [QOP_FMIN] = { "fmin", 1, 2 },
         [QOP_FMAX] = { "fmax", 1, 2 },
         [QOP_FMINABS] = { "fminabs", 1, 2 },
@@ -173,6 +178,11 @@ qir_is_mul(struct qinst *inst)
         switch (inst->op) {
         case QOP_FMUL:
         case QOP_MUL24:
+        case QOP_V8MULD:
+        case QOP_V8MIN:
+        case QOP_V8MAX:
+        case QOP_V8ADDS:
+        case QOP_V8SUBS:
                 return true;
         default:
                 return false;
index fa9f5f61c944e63d9d81864e8d7c9dd26a3aabc4..fce24cd233042b81db373a39ed46be6544a31fc8 100644 (file)
@@ -67,6 +67,11 @@ enum qop {
         QOP_FADD,
         QOP_FSUB,
         QOP_FMUL,
+        QOP_V8MULD,
+        QOP_V8MIN,
+        QOP_V8MAX,
+        QOP_V8ADDS,
+        QOP_V8SUBS,
         QOP_MUL24,
         QOP_FMIN,
         QOP_FMAX,
@@ -563,6 +568,11 @@ QIR_ALU1(MOV)
 QIR_ALU2(FADD)
 QIR_ALU2(FSUB)
 QIR_ALU2(FMUL)
+QIR_ALU2(V8MULD)
+QIR_ALU2(V8MIN)
+QIR_ALU2(V8MAX)
+QIR_ALU2(V8ADDS)
+QIR_ALU2(V8SUBS)
 QIR_ALU2(MUL24)
 QIR_ALU1(SEL_X_0_ZS)
 QIR_ALU1(SEL_X_0_ZC)
index adf3a8b3658afcc71c14e10f91f6f49216f740a0..4c81deb8eaa12f585ec0d89f7f07e2098b71d5ee 100644 (file)
@@ -203,6 +203,11 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
                         A(NOT),
 
                         M(FMUL),
+                        M(V8MULD),
+                        M(V8MIN),
+                        M(V8MAX),
+                        M(V8ADDS),
+                        M(V8SUBS),
                         M(MUL24),
                 };