summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_const.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-10 18:06:02 -0700
committerBrian Paul <brianp@vmware.com>2010-03-10 18:09:49 -0700
commit22bb7ffd04ca9296bcafa929f448203880cbcb2b (patch)
treef360ea014ffdccc4afbaf293cc00de7447453b93 /src/gallium/auxiliary/gallivm/lp_bld_const.c
parenta75254dda98419b92f4656fcc00973426cb68cf7 (diff)
gallivm: constant building for scalar zero
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_const.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 53447757e8..8a275fa72f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -221,8 +221,16 @@ lp_build_undef(struct lp_type type)
LLVMValueRef
lp_build_zero(struct lp_type type)
{
- LLVMTypeRef vec_type = lp_build_vec_type(type);
- return LLVMConstNull(vec_type);
+ if (type.length == 1) {
+ if (type.floating)
+ return LLVMConstReal(LLVMFloatType(), 0.0);
+ else
+ return LLVMConstInt(LLVMIntType(type.width), 0, 0);
+ }
+ else {
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
+ return LLVMConstNull(vec_type);
+ }
}