gallivm: fix typo in lp_build_mul_norm
authorRoland Scheidegger <sroland@vmware.com>
Fri, 1 Feb 2013 16:34:36 +0000 (08:34 -0800)
committerRoland Scheidegger <sroland@vmware.com>
Sat, 9 Feb 2013 00:32:30 +0000 (16:32 -0800)
The signed case didn't do what the comment indicated. Should increase rounding
precision (at the expense of performance since the former code was effectively
a no-op).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_arit.c

index d930f09acc3f6487420eddef6c561cd314969004..b4e9f23dcc9b0d19532f4cdb14c0d40e4c249516 100644 (file)
@@ -769,7 +769,7 @@ lp_build_mul_norm(struct gallivm_state *gallivm,
    half = lp_build_const_int_vec(gallivm, wide_type, 1 << (n - 1));
    if (wide_type.sign) {
       LLVMValueRef minus_half = LLVMBuildNeg(builder, half, "");
-      LLVMValueRef sign = lp_build_shr_imm(&bld, half, wide_type.width - 1);
+      LLVMValueRef sign = lp_build_shr_imm(&bld, ab, wide_type.width - 1);
       half = lp_build_select(&bld, sign, minus_half, half);
    }
    ab = LLVMBuildAdd(builder, ab, half, "");