From: Brian Paul Date: Thu, 11 Mar 2010 01:06:02 +0000 (-0700) Subject: gallivm: constant building for scalar zero X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22bb7ffd04ca9296bcafa929f448203880cbcb2b;p=mesa.git gallivm: constant building for scalar zero --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c index 53447757e8e..8a275fa72f3 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); + } }