Mesa (master): pan/bi: Implement 16-bit COMBINE lowering
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 15:06:57 UTC 2020
Module: Mesa
Branch: master
Commit: fc4eb0714cd6ddf3aaeb865ef0694fc6596f6d56
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc4eb0714cd6ddf3aaeb865ef0694fc6596f6d56
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Mon Apr 27 10:37:20 2020 -0400
pan/bi: Implement 16-bit COMBINE lowering
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4766>
---
src/panfrost/bifrost/bi_lower_combine.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/panfrost/bifrost/bi_lower_combine.c b/src/panfrost/bifrost/bi_lower_combine.c
index cdfbcd401eb..8cbe42c54d0 100644
--- a/src/panfrost/bifrost/bi_lower_combine.c
+++ b/src/panfrost/bifrost/bi_lower_combine.c
@@ -61,6 +61,25 @@ bi_combine_mov32(bi_context *ctx, bi_instruction *parent, unsigned comp, unsigne
bi_emit_before(ctx, parent, move);
}
+static void
+bi_combine_sel16(bi_context *ctx, bi_instruction *parent, unsigned comp, unsigned R)
+{
+ bi_instruction sel = {
+ .type = BI_SELECT,
+ .dest = R,
+ .dest_type = nir_type_uint32,
+ .dest_offset = comp >> 1,
+ .src = { parent->src[comp], parent->src[comp + 1] },
+ .src_types = { nir_type_uint16, nir_type_uint16 },
+ .swizzle = { {
+ parent->swizzle[comp][0],
+ parent->swizzle[comp + 1][0],
+ } }
+ };
+
+ bi_emit_before(ctx, parent, sel);
+}
+
/* Gets the instruction generating a given source. Combine lowering is
* accidentally O(n^2) right now because this function is O(n) instead of O(1).
* If this pass is slow, this cost can be avoided in favour for better
@@ -196,7 +215,12 @@ bi_lower_combine(bi_context *ctx, bi_block *block)
bi_insert_combine_mov(ctx, ins, s, R);
}
#endif
- bi_combine_mov32(ctx, ins, s, R);
+ if (ins->dest_type == nir_type_uint32)
+ bi_combine_mov32(ctx, ins, s, R);
+ else {
+ bi_combine_sel16(ctx, ins, s, R);
+ s++;
+ }
}
More information about the mesa-commit
mailing list