diff options
author | Christoph Bumiller <[email protected]> | 2012-01-07 18:42:13 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-01-10 00:37:37 +0100 |
commit | ae828413c4a98ba3546f5586f2e20d9da718ab0c (patch) | |
tree | a81b910b5ff7f83244dd544503153ada9d287a32 | |
parent | 6ab6110133c2d316d98f78bbc38bca0c5b6184a7 (diff) |
nv50/ir/opt: optimize u32 MOD by power of 2 into AND
-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)); |