diff options
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp index 2a7a981ac61..fc025d8767e 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp @@ -698,6 +698,14 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue *src, int s) } break; + case OP_MOD: + if (i->sType == TYPE_U32 && imm.isPow2()) { + bld.setPosition(i, false); + i->op = OP_AND; + i->setSrc(1, bld.loadImm(NULL, imm.reg.data.u32 - 1)); + } + break; + case OP_SET: // TODO: SET_AND,OR,XOR { CmpInstruction *si = findOriginForTestWithZero(i->getSrc(t)); |