Skip to content

r300: allow presubtract when both ADD sources are negative

Current code doesn't handle this, however it is easy to make it work by moving the negate to the presubtract source. Minor win in shader-db, mostly with Unigine shaders.

Example of such case:

 ADD temp[38].xyz, -input[1].xyz_, -temp[37].xyz_;
 DP3 temp[39].x, temp[38].xyz_, input[2].xyz_;

now becomes:

DP3 temp[39].x, (temp[37] + input[1]).-x-y-z_, input[2].xyz_;

Shader-db RV530:

total instructions in shared programs: 136382 -> 136236 (-0.11%)
instructions in affected programs: 9911 -> 9765 (-1.47%)
total temps in shared programs: 18939 -> 18942 (0.02%)
temps in affected programs: 37 -> 40 (8.11%)

Signed-off-by: Pavel Ondračka pavel.ondracka@gmail.com

Edited by Pavel Ondračka

Merge request reports