nv50/ir: fold MAD when one of the multiplicands is const
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 1 Jan 2015 06:01:13 +0000 (01:01 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 2 Jan 2015 02:40:35 +0000 (21:40 -0500)
commit9e94b87b6012450d714edc6d0c46b15a89d5ce61
tree122410bb3185ad43c8919fced4a1df3220c04899
parent290553b6d637779cb733549a582230437545d335
nv50/ir: fold MAD when one of the multiplicands is const

Fold MAD dst, src0, immed, src2 (or src0/immed swapped) when
 - immed = 0 -> MOV dst, src2
 - immed = +/- 1 -> ADD dst, src0, src2

These types of MAD patterns were observed in some st/nine shaders.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp