summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_const.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_const.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 57843e9a60..031ce9d1a3 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -301,6 +301,9 @@ lp_build_const_vec(struct lp_type type,
elems[0] = LLVMConstInt(elem_type, val*dscale + 0.5, 0);
}
+ if (type.length == 1)
+ return elems[0];
+
for(i = 1; i < type.length; ++i)
elems[i] = elems[0];
@@ -321,6 +324,9 @@ lp_build_const_int_vec(struct lp_type type,
for(i = 0; i < type.length; ++i)
elems[i] = LLVMConstInt(elem_type, val, type.sign ? 1 : 0);
+ if (type.length == 1)
+ return elems[0];
+
return LLVMConstVector(elems, type.length);
}