summaryrefslogtreecommitdiff
path: root/lib/mesa/src/broadcom/qpu/qpu_instr.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-05-23 05:01:20 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-05-23 05:01:20 +0000
commite2a3acb64af2657b1181806818eacad061103c23 (patch)
tree7535f61f2c3f8a69404befb400ecca145be4429c /lib/mesa/src/broadcom/qpu/qpu_instr.c
parent1e3bb66f697283b6bd192f3a000d99d637624079 (diff)
Import Mesa 19.0.5
Diffstat (limited to 'lib/mesa/src/broadcom/qpu/qpu_instr.c')
-rw-r--r--lib/mesa/src/broadcom/qpu/qpu_instr.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/mesa/src/broadcom/qpu/qpu_instr.c b/lib/mesa/src/broadcom/qpu/qpu_instr.c
index 147017a65..add2d2a23 100644
--- a/lib/mesa/src/broadcom/qpu/qpu_instr.c
+++ b/lib/mesa/src/broadcom/qpu/qpu_instr.c
@@ -499,6 +499,23 @@ v3d_qpu_mul_op_num_src(enum v3d_qpu_mul_op op)
return 0;
}
+enum v3d_qpu_cond
+v3d_qpu_cond_invert(enum v3d_qpu_cond cond)
+{
+ switch (cond) {
+ case V3D_QPU_COND_IFA:
+ return V3D_QPU_COND_IFNA;
+ case V3D_QPU_COND_IFNA:
+ return V3D_QPU_COND_IFA;
+ case V3D_QPU_COND_IFB:
+ return V3D_QPU_COND_IFNB;
+ case V3D_QPU_COND_IFNB:
+ return V3D_QPU_COND_IFB;
+ default:
+ unreachable("Non-invertible cond");
+ }
+}
+
bool
v3d_qpu_magic_waddr_is_sfu(enum v3d_qpu_waddr waddr)
{
@@ -555,6 +572,20 @@ v3d_qpu_magic_waddr_is_tsy(enum v3d_qpu_waddr waddr)
waddr == V3D_QPU_WADDR_SYNCU);
}
+bool
+v3d_qpu_magic_waddr_loads_unif(enum v3d_qpu_waddr waddr)
+{
+ switch (waddr) {
+ case V3D_QPU_WADDR_VPMU:
+ case V3D_QPU_WADDR_TLBU:
+ case V3D_QPU_WADDR_TMUAU:
+ case V3D_QPU_WADDR_SYNCU:
+ return true;
+ default:
+ return false;
+ }
+}
+
static bool
v3d_qpu_add_op_reads_vpm(enum v3d_qpu_add_op op)
{
@@ -795,3 +826,44 @@ v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo,
sig->ldtlb ||
sig->ldtlbu);
}
+
+bool
+v3d_qpu_reads_flags(const struct v3d_qpu_instr *inst)
+{
+ if (inst->type == V3D_QPU_INSTR_TYPE_BRANCH) {
+ return inst->branch.cond != V3D_QPU_BRANCH_COND_ALWAYS;
+ } else if (inst->type == V3D_QPU_INSTR_TYPE_ALU) {
+ if (inst->flags.ac != V3D_QPU_COND_NONE ||
+ inst->flags.mc != V3D_QPU_COND_NONE ||
+ inst->flags.auf != V3D_QPU_UF_NONE ||
+ inst->flags.muf != V3D_QPU_UF_NONE)
+ return true;
+
+ switch (inst->alu.add.op) {
+ case V3D_QPU_A_VFLA:
+ case V3D_QPU_A_VFLNA:
+ case V3D_QPU_A_VFLB:
+ case V3D_QPU_A_VFLNB:
+ case V3D_QPU_A_FLAPUSH:
+ case V3D_QPU_A_FLBPUSH:
+ return true;
+ default:
+ break;
+ }
+ }
+
+ return false;
+}
+
+bool
+v3d_qpu_writes_flags(const struct v3d_qpu_instr *inst)
+{
+ if (inst->flags.apf != V3D_QPU_PF_NONE ||
+ inst->flags.mpf != V3D_QPU_PF_NONE ||
+ inst->flags.auf != V3D_QPU_UF_NONE ||
+ inst->flags.muf != V3D_QPU_UF_NONE) {
+ return true;
+ }
+
+ return false;
+}