pan/bi: Add bi_replace_index helper

I keep open-coding this, incorrectly... Since bi_index contains both
"position" and "modifier" data, it's common to want to swap the position
while preserving modifiers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
This commit is contained in:
Alyssa Rosenzweig 2021-02-10 11:46:01 -05:00 committed by Marge Bot
parent 54beea9799
commit be02c0868c

View file

@ -199,6 +199,17 @@ bi_neg(bi_index idx)
return idx;
}
/* Replaces an index, preserving any modifiers */
static inline bi_index
bi_replace_index(bi_index old, bi_index replacement)
{
replacement.abs = old.abs;
replacement.neg = old.neg;
replacement.swizzle = old.swizzle;
return replacement;
}
/* For bitwise instructions */
#define bi_not(x) bi_neg(x)