freedreno/ir3: optimize immed 2nd src to mad
authorRob Clark <robdclark@chromium.org>
Mon, 30 Sep 2019 18:44:16 +0000 (11:44 -0700)
committerRob Clark <robdclark@chromium.org>
Fri, 18 Oct 2019 22:08:54 +0000 (15:08 -0700)
commitc7b8f16beeb0266764e3f48606328d3b2b69a263
treedc22cc09ad157416050037f26d4ed6fd812b39c7
parent666b6236f72932b2d6c8d816574357a113b3205c
freedreno/ir3: optimize immed 2nd src to mad

We can't encode immed sources for cat3 (mad) instructions, but we can
use const in first or third src.  We handled this case already, but we
weren't considering that we could lower immed to const.

For manhattan:

  total instructions in shared programs: 35202 -> 34718 (-1.37%)
  instructions in affected programs: 14931 -> 14447 (-3.24%)
  helped: 90
  HURT: 0
  total full in shared programs: 2451 -> 2359 (-3.75%)
  full in affected programs: 653 -> 561 (-14.09%)
  helped: 69
  HURT: 2

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/freedreno/ir3/ir3_cp.c