freedreno/ir3/cp: support to swap mad src's
authorRob Clark <robclark@freedesktop.org>
Mon, 6 Apr 2015 14:48:11 +0000 (10:48 -0400)
committerRob Clark <robclark@freedesktop.org>
Sat, 11 Apr 2015 15:39:46 +0000 (11:39 -0400)
commitf0e9a632a12798bd727799e396cde665bd960665
tree2c34e7378cd03c5424cec08873d76aaea4ae96bc
parentf59613561694cc4a4b81db8a73f8afe893dbacac
freedreno/ir3/cp: support to swap mad src's

For a normal MAD (ie. not MADSH), if first source is gpr and second
source is const, we can swap the first two sources to avoid needing a
mov instruction.

This gives back the biggest advantage TGSI f/e had over NIR f/e for
common shaders, since TGSI f/e had this logic in the f/e.  Note that
doing this in copy-prop step has the advantage that it will also work
for cases like:

   MOV TEMP[b], CONST[x]
   MAD TEMP[d], TEMP[a], TEMP[b], TEMP[c]

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/instr-a3xx.h
src/gallium/drivers/freedreno/ir3/ir3.h
src/gallium/drivers/freedreno/ir3/ir3_cp.c
src/gallium/drivers/freedreno/ir3/ir3_depth.c