From 38625af0101b9a5d1c9b57b3b9de1425af8c69b8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 21 Dec 2021 17:18:28 -0500 Subject: [PATCH] pan/bi: Add Valhall-specific zero builder When emitting code during or after register allocation, we need to be able to emit constants without running the constant->{LUT, move, uniform} pass running after. In particular, we need to access the constant 0 to implement spill code. Add a Valhall-specific zero for this purpose. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 50a057805ae..912094f9da9 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -790,6 +790,31 @@ bi_fau(enum bir_fau value, bool hi) }; } +/* + * Builder for Valhall LUT entries. Generally, constants are modeled with + * BI_INDEX_IMMEDIATE in the intermediate representation. This helper is only + * necessary for passes running after lowering constants, as well as when + * lowering constants. + * + */ +static inline bi_index +va_lut(unsigned index) +{ + return bi_fau((enum bir_fau) (BIR_FAU_IMMEDIATE | (index >> 1)), + index & 1); +} + +/* + * va_lut_zero is like bi_zero but only works on Valhall. It is intended for + * use by late passes that run after constants are lowered, specifically + * register allocation. bi_zero() is preferred where possible. + */ +static inline bi_index +va_zero_lut() +{ + return va_lut(0); +} + static inline unsigned bi_max_temp(bi_context *ctx) {