Mesa (master): gallivm: Don't call LLVMBuildFNeg on llvm-2.6.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Aug 9 16:32:24 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Aug  9 17:26:18 2010 +0100

gallivm: Don't call LLVMBuildFNeg on llvm-2.6.

It didn't exist yet.

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c     |    7 +++----
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |    6 +-----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index d2dde41..cecc185 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -512,10 +512,7 @@ lp_build_mul_imm(struct lp_build_context *bld,
       return a;
 
    if(b == -1)
-      if (bld->type.floating)
-         return LLVMBuildFNeg(bld->builder, a, "");
-      else
-         return LLVMBuildNeg(bld->builder, a, "");
+      return lp_build_negate(bld, a);
 
    if(b == 2 && bld->type.floating)
       return lp_build_add(bld, a, a);
@@ -748,9 +745,11 @@ LLVMValueRef
 lp_build_negate(struct lp_build_context *bld,
                 LLVMValueRef a)
 {
+#if HAVE_LLVM >= 0x0207
    if (bld->type.floating)
       a = LLVMBuildFNeg(bld->builder, a, "");
    else
+#endif
       a = LLVMBuildNeg(bld->builder, a, "");
 
    return a;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index becbd3b..0aa64af 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -506,7 +506,6 @@ emit_fetch(
    const unsigned chan_index )
 {
    const struct tgsi_full_src_register *reg = &inst->Src[src_op];
-   const struct lp_type type = bld->base.type;
    const unsigned swizzle =
       tgsi_util_get_full_src_register_swizzle(reg, chan_index);
    LLVMValueRef res;
@@ -615,10 +614,7 @@ emit_fetch(
       res = lp_build_abs( &bld->base, res );
       /* fall through */
    case TGSI_UTIL_SIGN_TOGGLE:
-      if (type.floating)
-         res = LLVMBuildFNeg( bld->base.builder, res, "" );
-      else
-         res = LLVMBuildNeg( bld->base.builder, res, "" );
+      res = lp_build_negate( &bld->base, res );
       break;
 
    case TGSI_UTIL_SIGN_KEEP:




More information about the mesa-commit mailing list