pan/bi: Fix loads and stores smaller than 32 bits

Spiritual successor to Icecream95's patch of the same name.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
This commit is contained in:
Alyssa Rosenzweig 2021-04-09 17:06:27 -04:00 committed by Marge Bot
parent 0ca7926bb6
commit 998cbe13d4
1 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,11 @@ TEMPLATE = """
#include "compiler.h"
<%
# For <32-bit loads/stores, the default extend `none` with a natural sized
# input is not encodeable! To avoid a footgun, swap the default to `zext` which
# will work as expected
ZEXT_DEFAULT = set(["LOAD.i8", "LOAD.i16", "LOAD.i24", "STORE.i8", "STORE.i16", "STORE.i24"])
def nirtypes(opcode):
split = opcode.split('.', 1)
if len(split) < 2:
@ -114,6 +119,9 @@ bi_instr * bi_${opcode.replace('.', '_').lower()}${to_suffix(ops[opcode])}(${sig
% for imm in ops[opcode]["immediates"]:
I->${imm} = ${imm};
% endfor
% if opcode in ZEXT_DEFAULT:
I->extend = BI_EXTEND_ZEXT;
% endif
bi_builder_insert(&b->cursor, I);
return I;
}