On 08/17/2016 12:08 PM, Matt Turner wrote:
On Wed, Aug 17, 2016 at 10:59 AM, Brian Paul <bri...@vmware.com> wrote:
The lrint() and lrintf() functions are pretty slow and make some
texture transfers very inefficient.  This patch makes a better effort
at using those intrisics for 32-bit gcc and MSVC.

Note, this patch doesn't address the use of SSE4.1 with MSVC.

Reviewed-by: José Fonseca <jfons...@vmware.com>
---
  src/util/rounding.h | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/util/rounding.h b/src/util/rounding.h
index afb38fb..ab55ebb 100644
--- a/src/util/rounding.h
+++ b/src/util/rounding.h
@@ -29,9 +29,11 @@
  #include <limits.h>
  #include <stdint.h>

-#ifdef __x86_64__
+#if defined(__SSE__) || defined(_MSC_VER)
+/* MSVC always has SSE nowadays */
  #include <xmmintrin.h>
  #include <emmintrin.h>
+#define ROUND_WITH_SSE 1

I wonder why not replace the ifdef __x86_64__ with SSE || _MSC_VER
like you did above.

I was thinking of also having a ROUND_WITH_SSE_4_1 at some point for the other two functions (since checking for that may be more complicated). But since those aren't used for texture transfers I probably won't bother afterall.



Either way,

Reviewed-by: Matt Turner <matts...@gmail.com>

Also, -fno-math-errno and -fno-trapping-math make various rounding
functions compile to single or very few instructions with gcc. If MSVC
has similar flags, it might be worth enabling them.

Thanks.

-Brian

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to