From dfe650f3f9b3454b78323fb4ad8743f766a80280 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Thu, 11 May 2023 13:32:28 +0200 Subject: [PATCH] freedreno/rnn: Make addvariant work for fields in the same reg Previously if addvariant was processed after other fields in the reg these fields would never get matched. Fix this by moving bitfields that add variant to the beginning of the list. Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/rnn/rnn.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/freedreno/rnn/rnn.c b/src/freedreno/rnn/rnn.c index 1533d45..e16a570 100644 --- a/src/freedreno/rnn/rnn.c +++ b/src/freedreno/rnn/rnn.c @@ -1224,8 +1224,19 @@ static void preptypeinfo(struct rnndb *db, struct rnntypeinfo *ti, char *prefix, if (ti->addvariant && ti->type != RNN_TTYPE_ENUM) { rnn_err(db, "%s: addvariant specified on non-enum type %s\n", prefix, ti->name); } - for (i = 0; i < ti->bitfieldsnum; i++) + for (i = 0; i < ti->bitfieldsnum; i++) { prepbitfield(db, ti->bitfields[i], prefix, vi); + if (ti->bitfields[i]->typeinfo.addvariant) { + for (int j = 0; j < i; j++) { + if (!ti->bitfields[j]->typeinfo.addvariant) { + struct rnnbitfield *t = ti->bitfields[j]; + ti->bitfields[j] = ti->bitfields[i]; + ti->bitfields[i] = t; + break; + } + } + } + } for (i = 0; i < ti->valsnum; i++) prepvalue(db, ti->vals[i], prefix, vi); } -- 2.7.4