[Mesa-dev] [PATCH 5/5] nv50/ir: detect when a SLCT is equivalent to a SET

Ilia Mirkin imirkin at alum.mit.edu
Fri Oct 21 06:43:32 UTC 2016


On Fri, Oct 21, 2016 at 2:39 AM, Karol Herbst <karolherbst at gmail.com> wrote:
>
>
> On 21 October 2016 8:30:33 a.m. GMT+02:00, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>---
>>.../drivers/nouveau/codegen/nv50_ir_peephole.cpp   | 23
>>++++++++++++++++++----
>> 1 file changed, 19 insertions(+), 4 deletions(-)
>>
>>diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>index f6fce44..c555430 100644
>>--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>@@ -637,10 +637,25 @@ ConstantFolding::expr(Instruction *i,
>>       }
>>       break;
>>    case OP_SLCT:
>>-      if (a->data.u32 != b->data.u32)
>>-         return;
>>-      res.data.u32 = a->data.u32;
>>-      break;
>>+      if (a->data.u32 == b->data.u32) {
>>+         res.data.u32 = a->data.u32;
>>+         break;
>>+      }
>>+      if ((a->data.u32 == 0 && b->data.u32 == 0xffffffff) ||
>>+          (b->data.u32 == 0 && a->data.u32 == 0xffffffff)) {
>>+         bld.setPosition(i, false);
>
> why do you need the bld.setPosition here?

Because an earlier version of the code had a bld.loadImm(0). However I
cleverly got rid of that, and stupidly forgot the bld.setPosition.

>
>>+         CmpInstruction *ci = i->asCmp();
>>+         i->op = OP_SET;
>>+         i->dType = TYPE_U32;
>>+         if (a->data.u32 == 0) {
>>+            ci->setCond = inverseCondCode(ci->setCond);
>>+            i->setSrc(1, i->getSrc(0));
>>+         }
>>+         i->setSrc(0, i->getSrc(2));
>>+         i->moveSources(3, -1);
>>+         ++foldCount;
>>+      }
>>+      return;
>>    case OP_EXTBF: {
>>       int offset = b->data.u32 & 0xff;
>>       int width = (b->data.u32 >> 8) & 0xff;
>>--
>>2.7.3
>>
>>_______________________________________________
>>mesa-dev mailing list
>>mesa-dev at lists.freedesktop.org
>>https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list