mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-24 10:20:22 +01:00
nv50/ir: Properly fold constants in SPLIT operation
Fixes:b7d9677d("nv50/ir: constant fold OP_SPLIT") Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Pierre Moreau <pierre.morrow@free.fr> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (cherry picked from commitafb8f2d4a3)
This commit is contained in:
parent
8b7ba85705
commit
940e50f754
1 changed files with 4 additions and 3 deletions
|
|
@ -938,8 +938,9 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
|
|||
bld.setPosition(i, false);
|
||||
|
||||
uint8_t size = i->getDef(0)->reg.size;
|
||||
uint32_t mask = (1ULL << size) - 1;
|
||||
assert(size <= 32);
|
||||
uint8_t bitsize = size * 8;
|
||||
uint32_t mask = (1ULL << bitsize) - 1;
|
||||
assert(bitsize <= 32);
|
||||
|
||||
uint64_t val = imm0.reg.data.u64;
|
||||
for (int8_t d = 0; i->defExists(d); ++d) {
|
||||
|
|
@ -947,7 +948,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
|
|||
assert(def->reg.size == size);
|
||||
|
||||
newi = bld.mkMov(def, bld.mkImm((uint32_t)(val & mask)), TYPE_U32);
|
||||
val >>= size;
|
||||
val >>= bitsize;
|
||||
}
|
||||
delete_Instruction(prog, i);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue