summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau/codegen
diff options
context:
space:
mode:
authorPierre Moreau <pierre.morrow@free.fr>2017-06-12 22:53:52 +0200
committerAndres Gomez <agomez@igalia.com>2017-06-28 20:15:05 +0300
commit940e50f75413bc355e3bc0ac34a25a2d1b6b6fcf (patch)
tree00d5a3a3b35c2e40da9fb0cf5d2ccce0dadf7355 /src/gallium/drivers/nouveau/codegen
parent8b7ba85705d2a895aca0a5a2113200154c485a68 (diff)
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 commit afb8f2d4a346041adf54d45729963a55a625ac1f)
Diffstat (limited to 'src/gallium/drivers/nouveau/codegen')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 4c92a1efb51..5dac2f64f0a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -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;