nv50/ir: allow OP_SET to merge with OP_SET_AND/etc as well as a neg
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 9 May 2015 03:46:53 +0000 (23:46 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 22 May 2015 20:51:05 +0000 (16:51 -0400)
commita85aba190dfab02ffccf744bad5ad10357394de0
tree29ff06ed01db4acb8d8c44fcdca0b3e9641f22bb
parentd2a474e8d4b03f10aec57c7f7740addad1e1ea9d
nv50/ir: allow OP_SET to merge with OP_SET_AND/etc as well as a neg

This covers the pattern where a KILL_IF is used, which triggers a
comparison of -x to 0. This can usually be folded into the comparison whose
result is being compared to 0, however it may, itself, have already been
combined with another comparison. That shouldn't impact the logic of
this pass however. With this and the & 1.0 change, code like

00000020001c0001 80081df4     set b32 $r0 lt f32 $r0 0x3e800000
00000028001c0000 201fc000     and b32 $r0 $r0 0x3f800000
000000307f9c001e dd885c00     set $p0 0x1 lt f32 neg $r0 0x0
000000380000003c 19800000     $p0 discard

becomes

00000020001c001d b5881df4     set $p0 0x1 lt f32 $r0 0x3e800000
000000280000003c 19800000     $p0 discard

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