X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fgallivm%2Flp_bld_swizzle.c;h=b1aef715e204f995dd711bb3a7ed482ffd493f3b;hb=259ec77db9027ddc33b290010167c712c925a82d;hp=9557e1c10de796ae54687dc7baedd423d46d2369;hpb=2eddf91faf4abf0b3d7b81a0a486fd46d5acd1ea;p=mesa.git diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c index 9557e1c10de..b1aef715e20 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c @@ -58,24 +58,14 @@ lp_build_broadcast(struct gallivm_state *gallivm, LLVMBuilderRef builder = gallivm->builder; const unsigned length = LLVMGetVectorSize(vec_type); LLVMValueRef undef = LLVMGetUndef(vec_type); + /* The shuffle vector is always made of int32 elements */ LLVMTypeRef i32_type = LLVMInt32TypeInContext(gallivm->context); + LLVMTypeRef i32_vec_type = LLVMVectorType(i32_type, length); assert(LLVMGetElementType(vec_type) == LLVMTypeOf(scalar)); - if (HAVE_LLVM >= 0x207) { - /* The shuffle vector is always made of int32 elements */ - LLVMTypeRef i32_vec_type = LLVMVectorType(i32_type, length); - res = LLVMBuildInsertElement(builder, undef, scalar, LLVMConstNull(i32_type), ""); - res = LLVMBuildShuffleVector(builder, res, undef, LLVMConstNull(i32_vec_type), ""); - } else { - /* XXX: The above path provokes a bug in LLVM 2.6 */ - unsigned i; - res = undef; - for(i = 0; i < length; ++i) { - LLVMValueRef index = lp_build_const_int32(gallivm, i); - res = LLVMBuildInsertElement(builder, res, scalar, index, ""); - } - } + res = LLVMBuildInsertElement(builder, undef, scalar, LLVMConstNull(i32_type), ""); + res = LLVMBuildShuffleVector(builder, res, undef, LLVMConstNull(i32_vec_type), ""); } return res;