nv50/ir: fix emission of 16-bit add

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9299>
This commit is contained in:
Ilia Mirkin 2021-02-28 20:08:25 -05:00
parent fe93723aaa
commit a3b02fea7e
1 changed files with 3 additions and 2 deletions

View File

@ -1083,17 +1083,18 @@ CodeEmitterNV50::emitUADD(const Instruction *i)
const int neg0 = i->src(0).mod.neg();
const int neg1 = i->src(1).mod.neg() ^ ((i->op == OP_SUB) ? 1 : 0);
code[0] = 0x20008000;
code[0] = 0x20000000;
if (i->src(1).getFile() == FILE_IMMEDIATE) {
code[0] |= (typeSizeof(i->dType) == 2) ? 0 : 0x00008000;
code[1] = 0;
emitForm_IMM(i);
} else
if (i->encSize == 8) {
code[0] = 0x20000000;
code[1] = (typeSizeof(i->dType) == 2) ? 0 : 0x04000000;
emitForm_ADD(i);
} else {
code[0] |= (typeSizeof(i->dType) == 2) ? 0 : 0x00008000;
emitForm_MUL(i);
}
assert(!(neg0 && neg1));