Mesa (master): llvmpipe: Always use floating-point operators for floating-point types

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Aug 10 09:25:09 UTC 2010


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

Author: nobled <nobled at dreamwidth.org>
Date:   Fri Aug  6 17:32:29 2010 +0000

llvmpipe: Always use floating-point operators for floating-point types

See:
http://bugs.freedesktop.org/29404
http://bugs.freedesktop.org/29407

Signed-off-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/drivers/llvmpipe/lp_bld_interp.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
index 78744da..2cf6f38 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
@@ -141,7 +141,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
                else {
                   dadx = LLVMBuildLoad(builder, LLVMBuildGEP(builder, dadx_ptr, &index, 1, ""), "");
                   dady = LLVMBuildLoad(builder, LLVMBuildGEP(builder, dady_ptr, &index, 1, ""), "");
-                  dadxy = LLVMBuildAdd(builder, dadx, dady, "");
+                  dadxy = LLVMBuildFAdd(builder, dadx, dady, "");
                   attrib_name(dadx, attrib, chan, ".dadx");
                   attrib_name(dady, attrib, chan, ".dady");
                   attrib_name(dadxy, attrib, chan, ".dadxy");
@@ -177,7 +177,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
              * dadq2 = 2 * dq
              */
 
-            dadq2 = LLVMBuildAdd(builder, dadq, dadq, "");
+            dadq2 = LLVMBuildFAdd(builder, dadq, dadq, "");
 
             /*
              * a = a0 + x * dadx + y * dady
@@ -193,12 +193,11 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
                a = a0;
                if (interp != LP_INTERP_CONSTANT &&
                    interp != LP_INTERP_FACING) {
-                  a = LLVMBuildAdd(builder, a,
-                                   LLVMBuildMul(builder, bld->x, dadx, ""),
-                                   "");
-                  a = LLVMBuildAdd(builder, a,
-                                   LLVMBuildMul(builder, bld->y, dady, ""),
-                                   "");
+                  LLVMValueRef tmp;
+                  tmp = LLVMBuildFMul(builder, bld->x, dadx, "");
+                  a = LLVMBuildFAdd(builder, a, tmp, "");
+                  tmp = LLVMBuildFMul(builder, bld->y, dady, "");
+                  a = LLVMBuildFAdd(builder, a, tmp, "");
                }
             }
 
@@ -212,7 +211,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
              * Compute the attrib values on the upper-left corner of each quad.
              */
 
-            a = LLVMBuildAdd(builder, a, dadq2, "");
+            a = LLVMBuildFAdd(builder, a, dadq2, "");
 
             /*
              * a    *= 1 / w




More information about the mesa-commit mailing list