r300: be smarter with ARL
Just some random shader from shader-db, but such patterns are quite common it seems
5: MAD temp[0].x, temp[0].x___, temp[0].-y___, temp[0].z___;
6: MOV temp[1], input[2];
7: MAD temp[1], none.1111, input[0].xy01, temp[1].00w0;
8: ARL addr[0].x, temp[0].x___;
9: MOV temp[2], const[15 + addr[0]];
10: DP4 temp[0].y, temp[1], temp[2];
11: ARL addr[0].x, temp[0].x___;
12: MOV temp[3], const[16 + addr[0]];
13: DP4 temp[0].z, temp[1], temp[3];
14: ARL addr[0].x, temp[0].x___;
15: DP4 temp[0].w, temp[1], const[17 + addr[0]];
Two problems in the example:
-
We should copy-propagate the movs -
We shoould be reusing the addr[0] register.
One more in example below:
-
We should be vectorizing the addr[0] register loads when possible.
Edited by Pavel Ondračka