Man, this expression was wrong. First of all, raw is 64-bit so our mask needs to
be too. Second, length is in bytes -- not bits -- so we need to multiply by 8 to
get something sensible. In effect, the old wrong expression would always use the
long encoding for ALU instructions... whoops. This particular bug probably goes
back to the very first version of agx_pack...
Massive improvement in code density. Noticed while comparing assembly with the
blob. It's my Saturday, I can pointless optimize if I want to.
total bytes in shared programs:
12175112 ->
11720338 (-3.74%)
bytes in affected programs:
11963800 ->
11509026 (-3.80%)
helped: 16624
HURT: 0
Bytes are helped.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>
/* Determine length bit */
unsigned length = encoding.length_short;
- unsigned short_mask = (1 << length) - 1;
+ uint64_t short_mask = BITFIELD64_MASK(8 * length);
bool length_bit = (extend || (raw & ~short_mask));
if (encoding.extensible && length_bit) {