pan/bi: Add nullity/equality helpers for bi_index

We can no longer use the builtin equals, since they're structs now, but
these helpers are almost as convenient.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8215>
This commit is contained in:
Alyssa Rosenzweig 2020-12-11 20:01:38 -05:00
parent 5dd756afed
commit 3a63b5d7cf

View file

@ -471,6 +471,24 @@ bi_passthrough(enum bifrost_packed_src value)
};
}
static inline bool
bi_is_null(bi_index idx)
{
return idx.type == BI_INDEX_NULL;
}
/* Compares equivalence as references. Does not compare offsets, swizzles, or
* modifiers. In other words, this forms bi_index equivalence classes by
* partitioning memory. E.g. -abs(foo[1].yx) == foo.xy but foo != bar */
static inline bool
bi_is_equiv(bi_index left, bi_index right)
{
return (left.type == right.type) &&
(left.reg == right.reg) &&
(left.value == right.value);
}
/* Represents the assignment of slots for a given bi_bundle */
typedef struct {