Mesa (master): Conditionally revert "gallivm: Use a more compact approach for lp_build_broadcast_scalar()."

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu May 13 20:14:43 UTC 2010


Module: Mesa
Branch: master
Commit: c5c0e0172fc42fcce317f960ef36e5591c38005e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5c0e0172fc42fcce317f960ef36e5591c38005e

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu May 13 21:03:08 2010 +0100

Conditionally revert "gallivm: Use a more compact approach for lp_build_broadcast_scalar()."

This reverts commit a09e46c72461183c879d8472b44fe740ecc79b9f.

---

 src/gallium/auxiliary/gallivm/lp_bld_swizzle.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index f095a39..3c8a7bc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -76,10 +76,20 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
    }
    else {
       LLVMValueRef res;
+#if HAVE_LLVM >= 0x207
       res = LLVMBuildInsertElement(bld->builder, bld->undef, scalar,
                                    LLVMConstInt(LLVMInt32Type(), 0, 0), "");
       res = LLVMBuildShuffleVector(bld->builder, res, bld->undef,
                                    lp_build_const_int_vec(type, 0), "");
+#else
+      /* XXX: The above path provokes a bug in LLVM 2.6 */
+      unsigned i;
+      res = bld->undef;
+      for(i = 0; i < type.length; ++i) {
+         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+         res = LLVMBuildInsertElement(bld->builder, res, scalar, index, "");
+      }
+#endif
       return res;
    }
 }




More information about the mesa-commit mailing list