broadcom/vc5: Fix pack/unpack of vfmul input unpack flags.
authorEric Anholt <eric@anholt.net>
Thu, 4 Jan 2018 18:34:36 +0000 (10:34 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 13 Jan 2018 05:53:38 +0000 (21:53 -0800)
src/broadcom/qpu/qpu_pack.c
src/broadcom/qpu/tests/qpu_disasm.c

index 6630ed4b85fea079c12cd3ef63ba29b521e0945d..02aa1b86aa4c935c2fcd4835cb6a4acc6765ec4f 100644 (file)
@@ -743,6 +743,19 @@ v3d_qpu_mul_unpack(const struct v3d_device_info *devinfo, uint64_t packed_inst,
                 }
 
                 break;
+
+        case V3D_QPU_M_VFMUL:
+                instr->alu.mul.output_pack = V3D_QPU_PACK_NONE;
+
+                if (!v3d_qpu_float16_unpack_unpack(((op & 0x7) - 4) & 7,
+                                                   &instr->alu.mul.a_unpack)) {
+                        return false;
+                }
+
+                instr->alu.mul.b_unpack = V3D_QPU_UNPACK_NONE;
+
+                break;
+
         default:
                 instr->alu.mul.output_pack = V3D_QPU_PACK_NONE;
                 instr->alu.mul.a_unpack = V3D_QPU_UNPACK_NONE;
@@ -1002,6 +1015,27 @@ v3d_qpu_mul_pack(const struct v3d_device_info *devinfo,
                 break;
         }
 
+        case V3D_QPU_M_VFMUL: {
+                uint32_t packed;
+
+                if (instr->alu.mul.output_pack != V3D_QPU_PACK_NONE)
+                        return false;
+
+                if (!v3d_qpu_float16_unpack_pack(instr->alu.mul.a_unpack,
+                                                 &packed)) {
+                        return false;
+                }
+                if (instr->alu.mul.a_unpack == V3D_QPU_UNPACK_SWAP_16)
+                        opcode = 8;
+                else
+                        opcode |= (packed + 4) & 7;
+
+                if (instr->alu.mul.b_unpack != V3D_QPU_UNPACK_NONE)
+                        return false;
+
+                break;
+        }
+
         default:
                 break;
         }
index c7f6476def5d43fa51e93737d06e1d211eed3f02..59668a86ecc7cb51f439644b219f3d79e26a1d41 100644 (file)
@@ -40,6 +40,12 @@ static const struct {
         { 33, 0x3c002380b6edb000ull, "or  rf0, r3, r3      ; mov  vpm, r3" },
         { 33, 0x57403006bbb80000ull, "nop                  ; fmul  r0, rf0, r5 ; ldvpm; ldunif" },
 
+        /* vfmul input packing */
+        { 33, 0x101e8b6e8aad4000ull, "fmax.nornn  rf46, r4.l, r2.l; vfmul.ifnb  rf45, r3, r5" },
+        { 33, 0x1857d3c219825000ull, "faddnf.norc  r2.l, r5.l, r4; vfmul.ifb  rf15, r0.ll, r4; ldunif" },
+        { 33, 0x1c0a0dfde2294000ull, "fcmp.ifna  rf61.h, r4.abs, r2.l; vfmul  rf55, r2.hh, r1" },
+        { 33, 0x2011c89b402cc000ull, "fsub.norz  rf27, r4.abs, r1.abs; vfmul.ifa  rf34, r3.swp, r1" },
+
         /* branch conditions */
         { 33, 0x02000006002034c0ull, "b.anyap  rf19" },
         { 33, 0x02679356b4201000ull, "b.anyap  -1268280496" },