aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/midgard_emit.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-07 16:09:47 -0400
committerMarge Bot <[email protected]>2020-05-21 17:49:14 +0000
commit8c012c8f8bb1871486d7f46fd98ff97c857fa64d (patch)
tree9537bb99739e53f82c32f9efd421f41ea156a135 /src/panfrost/midgard/midgard_emit.c
parent8084fc3b6615201165ebf1bd46ecd91606d1849b (diff)
pan/mdg: Handle dest up/lower correctly with swizzles
During emit time. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5151>
Diffstat (limited to 'src/panfrost/midgard/midgard_emit.c')
-rw-r--r--src/panfrost/midgard/midgard_emit.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c
index 99134ddcfb9..017c74e33bd 100644
--- a/src/panfrost/midgard/midgard_emit.c
+++ b/src/panfrost/midgard/midgard_emit.c
@@ -223,7 +223,11 @@ mir_pack_swizzle_alu(midgard_instruction *ins)
if (upper && ins->mask)
assert(nir_alu_type_get_type_size(ins->src_types[i]) <= 16);
- for (unsigned c = 0; c < 4; ++c) {
+ bool dest_up =
+ GET_CHANNEL_COUNT(alu_opcode_props[ins->alu.op].props) ? false :
+ (first >= 4);
+
+ for (unsigned c = (dest_up ? 4 : 0); c < (dest_up ? 8 : 4); ++c) {
unsigned v = ins->swizzle[i][c];
bool t_upper = v > 3;
@@ -238,16 +242,21 @@ mir_pack_swizzle_alu(midgard_instruction *ins)
/* Use the non upper part */
v &= 0x3;
- packed |= v << (2 * c);
+ packed |= v << (2 * (c % 4));
}
- src[i].rep_high = upper;
/* Replicate for now.. should really pick a side for
* dot products */
- if (ins->alu.reg_mode == midgard_reg_mode_16)
- src[i].rep_low = true;
+ if (ins->alu.reg_mode == midgard_reg_mode_16) {
+ src[i].rep_low = !upper;
+ src[i].rep_high = upper;
+ } else if (ins->alu.reg_mode == midgard_reg_mode_32) {
+ src[i].rep_low = upper;
+ } else {
+ unreachable("Unhandled reg mode");
+ }
}
src[i].swizzle = packed;