diff options
author | James Benton <jbenton@vmware.com> | 2012-05-18 16:06:44 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2012-05-21 20:24:47 +0100 |
commit | a3d4af0c00a198bba00c0965131a14223d426dd4 (patch) | |
tree | af3e4ad3e88e18dc6503e6f9c56e6decdd119f99 /src/gallium/auxiliary/gallivm/lp_bld_arit.c | |
parent | fdeb0394cbc737cefa36c6bf99cbd255d8899a9f (diff) | |
download | external_mesa3d-a3d4af0c00a198bba00c0965131a14223d426dd4.zip external_mesa3d-a3d4af0c00a198bba00c0965131a14223d426dd4.tar.gz external_mesa3d-a3d4af0c00a198bba00c0965131a14223d426dd4.tar.bz2 |
gallivm: Fixed erroneous optimisation in lp_build_min/max.
Previously assumed normalised was 0 to 1, but it can be -1 to 1
if type is signed.
Tested with lp_test_conv and lp_test_format, reduced errors.
Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_arit.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_arit.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index d112f1a..9fc5762 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -763,9 +763,12 @@ lp_build_min(struct lp_build_context *bld, if(a == b) return a; - if(bld->type.norm) { - if(a == bld->zero || b == bld->zero) - return bld->zero; + if (bld->type.norm) { + if (!bld->type.sign) { + if (a == bld->zero || b == bld->zero) { + return bld->zero; + } + } if(a == bld->one) return b; if(b == bld->one) @@ -797,10 +800,14 @@ lp_build_max(struct lp_build_context *bld, if(bld->type.norm) { if(a == bld->one || b == bld->one) return bld->one; - if(a == bld->zero) - return b; - if(b == bld->zero) - return a; + if (!bld->type.sign) { + if (a == bld->zero) { + return b; + } + if (b == bld->zero) { + return a; + } + } } return lp_build_max_simple(bld, a, b); |