Mesa (master): pan/midgard: Simplify mir_bytemask_of_read_components
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Oct 20 12:32:20 UTC 2019
Module: Mesa
Branch: master
Commit: 43fd730fc4d9382b94cc6f296f4e07e7508c3ca3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=43fd730fc4d9382b94cc6f296f4e07e7508c3ca3
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Thu Oct 17 22:18:36 2019 -0400
pan/midgard: Simplify mir_bytemask_of_read_components
There are easy ways to iterate sources!
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/panfrost/midgard/mir.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c
index 09868302a2e..76c99a2e05c 100644
--- a/src/panfrost/midgard/mir.c
+++ b/src/panfrost/midgard/mir.c
@@ -548,29 +548,15 @@ mir_bytemask_of_read_components_single(unsigned swizzle, unsigned inmask, midgar
return mir_to_bytemask(mode, cmask);
}
-static unsigned
-mir_source_count(midgard_instruction *ins)
-{
- if (ins->type == TAG_ALU_4) {
- /* ALU is always binary, except csel */
- return OP_IS_CSEL(ins->alu.op) ? 3 : 2;
- } else if (ins->type == TAG_LOAD_STORE_4) {
- bool load = !OP_IS_STORE(ins->load_store.op);
- return (load ? 2 : 3);
- } else if (ins->type == TAG_TEXTURE_4) {
- /* Coords, bias.. TODO: Offsets? */
- return 2;
- } else {
- unreachable("Invalid instruction type");
- }
-}
-
uint16_t
mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node)
{
uint16_t mask = 0;
- for (unsigned i = 0; i < mir_source_count(ins); ++i) {
+ if (node == ~0)
+ return 0;
+
+ mir_foreach_src(ins, i) {
if (ins->src[i] != node) continue;
/* Branch writeout uses all components */
More information about the mesa-commit
mailing list