glsl/standalone: Optimize add-of-neg to subtract
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 14 Sep 2016 20:52:42 +0000 (13:52 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 10 Nov 2016 22:30:49 +0000 (14:30 -0800)
commitf45a2a93aea0a57cf0aa8ee9ca062fcc42407a44
tree85b7c3c1afaaba0042e50621955d1c004250193b
parent9788b3b6f363580fd8d9d7e221cab28879e4d169
glsl/standalone: Optimize add-of-neg to subtract

This just makes the output of the standalone compiler a little more
compact.

v2: Fix indexing typo noticed by Iago.  Move the add_neg_to_sub_visitor
to it's own header file.  Add a unit test that exercises the visitor.
Both the neg_a_plus_b and neg_a_plus_neg_b tests reproduced the bug that
Iago discovered.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/Makefile.glsl.am
src/compiler/glsl/opt_add_neg_to_sub.h [new file with mode: 0644]
src/compiler/glsl/standalone.cpp
src/compiler/glsl/tests/opt_add_neg_to_sub_test.cpp [new file with mode: 0644]