From 846e38f1c33c3b2e46227886da57beda27b82f0c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 15 Dec 2009 12:13:43 +0000 Subject: llvmpipe: Fix bad SI -> FP conversion into lp_build_log2_approx. It should be a bitcast as the integer value is actually an encoded FP already. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 9c59677a74..4fd459e593 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -1285,7 +1285,7 @@ lp_build_log2_approx(struct lp_build_context *bld, /* mant = (float) mantissa(x) */ mant = LLVMBuildAnd(bld->builder, i, mantmask, ""); mant = LLVMBuildOr(bld->builder, mant, one, ""); - mant = LLVMBuildSIToFP(bld->builder, mant, vec_type, ""); + mant = LLVMBuildBitCast(bld->builder, mant, vec_type, ""); logmant = lp_build_polynomial(bld, mant, lp_build_log2_polynomial, Elements(lp_build_log2_polynomial)); -- cgit v1.2.3 From 72c98780697b40da5c34da0aec21d06e46a431d1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 15 Dec 2009 13:58:53 +0000 Subject: llvmpipe: Fix typo in lp_build_log constant. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 4fd459e593..f0af324404 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -1083,7 +1083,7 @@ lp_build_log(struct lp_build_context *bld, LLVMValueRef x) { /* log(2) */ - LLVMValueRef log2 = lp_build_const_scalar(bld->type, 1.4426950408889634); + LLVMValueRef log2 = lp_build_const_scalar(bld->type, 0.69314718055994529); return lp_build_mul(bld, log2, lp_build_exp2(bld, x)); } -- cgit v1.2.3 From 85c27c3ef7753ee8bae119dd982df09161b44d5f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 15 Dec 2009 14:15:52 +0000 Subject: llvmpipe: Fix lp_build_polynomial comment. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index f0af324404..08c86a3b92 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -1095,7 +1095,7 @@ lp_build_log(struct lp_build_context *bld, /** * Generate polynomial. - * Ex: x^2 * coeffs[0] + x * coeffs[1] + coeffs[2]. + * Ex: coeffs[0] + x * coeffs[1] + x^2 * coeffs[2]. */ static LLVMValueRef lp_build_polynomial(struct lp_build_context *bld, -- cgit v1.2.3 From 3a15c48ecedb985e2cecaaa9061ff579092069f1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 15 Dec 2009 14:46:43 +0000 Subject: llvmpipe: Fix yet another copynpaste typo in lp_build_log2_approx. Now fslight looks perfect. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 08c86a3b92..847c2a34b1 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -1291,7 +1291,7 @@ lp_build_log2_approx(struct lp_build_context *bld, Elements(lp_build_log2_polynomial)); /* This effectively increases the polynomial degree by one, but ensures that log2(1) == 0*/ - logmant = LLVMBuildMul(bld->builder, logmant, LLVMBuildMul(bld->builder, mant, bld->one, ""), ""); + logmant = LLVMBuildMul(bld->builder, logmant, LLVMBuildSub(bld->builder, mant, bld->one, ""), ""); res = LLVMBuildAdd(bld->builder, logmant, logexp, ""); } -- cgit v1.2.3 From 43d6c81ae2b3cb263f803bb9881c0823c1ed7dda Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Dec 2009 15:24:31 -0700 Subject: llvmpipe: fix broken lp_build_abs() --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_bld_arit.c') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 847c2a34b1..eea6b5d6a5 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -629,7 +629,8 @@ lp_build_abs(struct lp_build_context *bld, if(type.floating) { /* Mask out the sign bit */ LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); - LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long)1 << type.width) - 1); + unsigned long absMask = ~(1 << (type.width - 1)); + LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long) absMask)); a = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); a = LLVMBuildAnd(bld->builder, a, mask, ""); a = LLVMBuildBitCast(bld->builder, a, vec_type, ""); -- cgit v1.2.3