From d079631248c81e8b82b5deb8a4559e84f1a7893a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 16 Oct 2019 12:24:28 -0400 Subject: pan/midgard: Add helpers for manipulating byte masks There are essentially two formats of masks in play beginning with this commit: masks per-channel and masks per-byte. The former make sense within a given fixed-size instruction; the latter are typesize-independent. It turns out you need the latter to meaningfully manipulate instructions containing multiple sizes (which is quite possible with ALU operations). Similarly, we have mir_srcsize. We calculate the size of the source by analyzing the size of the instruction itself and stepping down if there is a half-modifier. Finally, we have mir_round_bytemask_down, for when we want to take a byte mask and "round it down" to a given component size, so that we can use it as a component mask. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/panfrost/midgard/compiler.h') diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 508f7fd3d18..4b51aabb096 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -514,6 +514,10 @@ unsigned mir_use_count(compiler_context *ctx, unsigned value); bool mir_is_written_before(compiler_context *ctx, midgard_instruction *ins, unsigned node); unsigned mir_mask_of_read_components(midgard_instruction *ins, unsigned node); unsigned mir_ubo_shift(midgard_load_store_op op); +midgard_reg_mode mir_typesize(midgard_instruction *ins); +uint16_t mir_from_bytemask(uint16_t bytemask, midgard_reg_mode mode); +uint16_t mir_bytemask(midgard_instruction *ins); +uint16_t mir_round_bytemask_down(uint16_t mask, midgard_reg_mode mode); /* MIR printing */ -- cgit v1.2.3