Commit 1a417095 authored by Emma Anholt's avatar Emma Anholt
Browse files

v3d: Fix pack/unpack of VFPACK operand unpacks.

We want to be able to copy propagate our texture unpacks into the vfpack.
parent d0fdbd42
......@@ -776,7 +776,11 @@ v3d_qpu_add_unpack(const struct v3d_device_info *devinfo, uint64_t packed_inst,
case V3D_QPU_A_FMIN:
case V3D_QPU_A_FMAX:
case V3D_QPU_A_FCMP:
instr->alu.add.output_pack = (op >> 4) & 0x3;
case V3D_QPU_A_VFPACK:
if (instr->alu.add.op != V3D_QPU_A_VFPACK)
instr->alu.add.output_pack = (op >> 4) & 0x3;
else
instr->alu.add.output_pack = V3D_QPU_PACK_NONE;
if (!v3d_qpu_float32_unpack_unpack((op >> 2) & 0x3,
&instr->alu.add.a_unpack)) {
......@@ -1042,6 +1046,32 @@ v3d_qpu_add_pack(const struct v3d_device_info *devinfo,
opcode |= a_unpack << 2;
opcode |= b_unpack << 0;
break;
}
case V3D_QPU_A_VFPACK: {
uint32_t a_unpack;
uint32_t b_unpack;
if (instr->alu.add.a_unpack == V3D_QPU_UNPACK_ABS ||
instr->alu.add.b_unpack == V3D_QPU_UNPACK_ABS) {
return false;
}
if (!v3d_qpu_float32_unpack_pack(instr->alu.add.a_unpack,
&a_unpack)) {
return false;
}
if (!v3d_qpu_float32_unpack_pack(instr->alu.add.b_unpack,
&b_unpack)) {
return false;
}
opcode = (opcode & ~(1 << 2)) | (a_unpack << 2);
opcode = (opcode & ~(1 << 0)) | (b_unpack << 0);
break;
}
......
......@@ -48,6 +48,8 @@ static const struct {
{ 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" },
{ 33, 0xe01b42ab3bb063c0ull, "vfpack.andnc rf43, rf15.l, r0.h; fmul.ifna rf10.h, r4.l, r5.abs" },
/* small immediates */
{ 33, 0x5de24398bbdc6218ull, "vflb.andnn rf24 ; fmul rf14, -8, rf8.h" },
{ 33, 0x25ef83d8b166f00full, "vfmin.pushn rf24, 15.ff, r5; smul24.ifnb rf15, r1, r3" },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment