From: Danylo Piliaiev Date: Thu, 11 May 2023 11:32:28 +0000 (+0200) Subject: freedreno/rnn: Make addvariant work for fields in the same reg X-Git-Tag: upstream/23.3.3~5733 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dfe650f3f9b3454b78323fb4ad8743f766a80280;p=platform%2Fupstream%2Fmesa.git 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: --- 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); }