From 7535362204642db2b59b48ac910cb74146bb96a6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 2 Jun 2022 20:27:41 -0400 Subject: [PATCH] pan/bi: Fix clper_xor on Mali-G31 Mali-G31 has the old CLPER instruction, not the new one, which means we don't get to specify a custom lane op. But the clper_xor helper incorrectly checked the arch, not the implementation quirk. Fixes: c00e7b729fe ("pan/bi: Optimize abs(derivative)") Signed-off-by: Alyssa Rosenzweig Reported-by: Icecream95 Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 6386e2675d0..cb5e368cd11 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2157,13 +2157,15 @@ bi_lower_fsincos_32(bi_builder *b, bi_index dst, bi_index s0, bool cos) bi_fadd_f32_to(b, dst, I->dest[0], cos ? cosx : sinx); } -/* The XOR lane op is useful for derivative calculation, but was added in v7. - * Add a safe helper that will do the appropriate lowering on v6 */ - +/* + * The XOR lane op is useful for derivative calculations, but not all Bifrost + * implementations have it. Add a safe helper that uses the hardware + * functionality when available and lowers where unavailable. + */ static bi_index bi_clper_xor(bi_builder *b, bi_index s0, bi_index s1) { - if (b->shader->arch >= 7) { + if (!(b->shader->quirks & BIFROST_LIMITED_CLPER)) { return bi_clper_i32(b, s0, s1, BI_INACTIVE_RESULT_ZERO, BI_LANE_OP_XOR, BI_SUBGROUP_SUBGROUP4);