nvc0/ir: also do ConstantFolding for FMA
authorKarol Herbst <karolherbst@gmail.com>
Tue, 21 Mar 2017 17:37:47 +0000 (18:37 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 1 Apr 2017 03:57:10 +0000 (23:57 -0400)
Helps mainly Feral-ported games, due to their use of fma()

shader-db changes:
total instructions in shared programs : 3941587 -> 3940749 (-0.02%)
total gprs used in shared programs    : 481511 -> 481460 (-0.01%)
total local used in shared programs   : 27469 -> 27481 (0.04%)
total bytes used in shared programs   : 36123344 -> 36115776 (-0.02%)

                local        gpr       inst      bytes
    helped           2          48         243         243
      hurt           2           3          32          32

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index d358abc5bd7d6906979fac10f3c947f5e35ec63c..2714b5ff7e00eaf1082eef899ad0a5621032b80c 100644 (file)
@@ -1026,6 +1026,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
          i->postFactor = 0;
       }
       break;
+   case OP_FMA:
    case OP_MAD:
       if (imm0.isInteger(0)) {
          i->setSrc(0, i->getSrc(2));