summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-08-21 11:31:22 +0100
committerJosé Fonseca <[email protected]>2010-08-30 13:26:29 +0100
commite18c7f68b4a18ba3f9ebfd0a4a24e3528cf44800 (patch)
treec596d44801474eb8a4fe85668318341486fd9510
parent1bb97610e969918015f46efe6fe32c6c71a8293a (diff)
gallivm: Fix lp_build_sum_vector.
The result is scalar, so when argument is zero/undef we can pass vector zero/undef. Also, support the scalar case.
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 7bb57061f5b..e0d30be98d9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -259,7 +259,7 @@ lp_build_add(struct lp_build_context *bld,
}
-/** Return the sum of the elements of a */
+/** Return the scalar sum of the elements of a */
LLVMValueRef
lp_build_sum_vector(struct lp_build_context *bld,
LLVMValueRef a)
@@ -270,11 +270,9 @@ lp_build_sum_vector(struct lp_build_context *bld,
assert(lp_check_value(type, a));
- if (a == bld->zero)
- return bld->zero;
- if (a == bld->undef)
- return bld->undef;
- assert(type.length > 1);
+ if (type.length == 1) {
+ return a;
+ }
assert(!bld->type.norm);