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 <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23881>
This commit is contained in:
Danylo Piliaiev 2023-05-11 13:32:28 +02:00 committed by Marge Bot
parent 15db60fbbc
commit dfe650f3f9

View file

@ -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);
}