i965: Fix negate with unsigned integers
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 19 Jan 2015 11:32:09 +0000 (12:32 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 3 Feb 2015 12:19:36 +0000 (13:19 +0100)
commit6dd346c2328df86f843c3a355a7919fb0404f6df
treead1a41101d354675228e871204a49b9094bfce7a
parent5b941ce8575089279b92797f7c10aa294cbc16c8
i965: Fix negate with unsigned integers

For code such as:

uint tmp1 = uint(in0);
uint tmp2 = -tmp1;
float out0 = float(tmp2);

We produce code like:
mov(8)    g5<1>.xF    -g9<4,4,1>.xUD

which does not produce correct results. This code produces the
results we would expect if tmp1 and tmp2 were signed integers
instead.

It seems that a similar problem was detected and addressed when
using negations with unsigned integers as part of condionals, but
it looks like the problem has a wider impact than that.

This patch fixes the problem by preventing copy-propagation of
negated UD registers in all scenarios, not only in conditionals.

Fixes the following 24 dEQP tests:

dEQP-GLES3.functional.shaders.operator.unary_operator.minus.*_uint_*
dEQP-GLES3.functional.shaders.operator.unary_operator.minus.*_uvec2_*
dEQP-GLES3.functional.shaders.operator.unary_operator.minus.*_uvec3_*
dEQP-GLES3.functional.shaders.operator.unary_operator.minus.*_uvec4_*

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp