From 455cde2562b6480bf31a46feb98e8d95eb81add8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 11 Jan 2021 13:50:43 -0500 Subject: [PATCH] pan/bi: Assert immediate indices fit This would have caught the assortment of bugs fixed in the previous two commits, and should help lint going forward. Signed-off-by: Alyssa Rosenzweig Tested-by: Maciej Matuszczyk Part-of: --- src/panfrost/bifrost/bi_packer.c.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panfrost/bifrost/bi_packer.c.py b/src/panfrost/bifrost/bi_packer.c.py index 13b31c3afa9..85af8619329 100644 --- a/src/panfrost/bifrost/bi_packer.c.py +++ b/src/panfrost/bifrost/bi_packer.c.py @@ -272,6 +272,7 @@ def pack_variant(opname, states): for (name, pos, width) in st[1].get("immediates", []): common_body.append('unsigned {} = I->{};'.format(name, name)) + common_body.append('assert({} < {});'.format(name, hex(1 << width))) for st in pack_exprs: st.append('({} << {})'.format(name, pos))