i965/fs: Add a local common subexpression elimination pass.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 10 May 2012 23:10:15 +0000 (16:10 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 14 May 2012 22:13:55 +0000 (15:13 -0700)
commita4e9b5a768d2d9e59b6054148afb6a6b94c0e4e6
tree0a83adee4d9020077f13a4a379060a9d53ae88ff
parentd1029f99884e2ba7f663765274cd6bdb4f82feed
i965/fs: Add a local common subexpression elimination pass.

Total instructions: 18210 -> 17836
49/163 programs affected (30.1%)
12888 -> 12514 instructions in affected programs (2.9% reduction)

This reduces Lightsmark's "Scale down filter" shader from 395
instructions to 283, a whopping 28%.  It also reduces register pressure
significantly: the SIMD8 program now uses 29 registers instead of 101,
giving us more than enough room for a SIMD16 program.

v2: Add && !inst->conditional_mod to the "skip some instructions" check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_cse.cpp [new file with mode: 0644]