From b55fb073a46056fed5f41126e4bff8fba2735b00 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 23 Jul 2021 14:34:22 -0400 Subject: [PATCH] pan/bi: Add strip_index helper Needed to correctly lower sources to moves, used in the FAU lowering. Technically, the issue is already present on Bifrost, but it's hidden because Bifrost packing doesn't validate the absense of unsupported modifiers. Valhall packing adds more safety, which caught this issue. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index f9838150bff..f93907e7532 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -236,6 +236,20 @@ bi_replace_index(bi_index old, bi_index replacement) return replacement; } +/* Remove any modifiers. This has the property: + * + * replace_index(x, strip_index(x)) = x + * + * This ensures it is suitable to use when lowering sources to moves */ + +static inline bi_index +bi_strip_index(bi_index index) +{ + index.abs = index.neg = false; + index.swizzle = BI_SWIZZLE_H01; + return index; +} + /* For bitwise instructions */ #define bi_not(x) bi_neg(x)