freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master a842a09: [smooth] Detect SSE2 with MSVC for x86


From: Werner Lemberg
Subject: [freetype2] master a842a09: [smooth] Detect SSE2 with MSVC for x86
Date: Fri, 27 Aug 2021 03:21:55 -0400 (EDT)

branch: master
commit a842a0984b13b7a271d6b4693c96cd354a6b1b81
Author: Ben Wagner <bungeman@chromium.org>
Commit: Werner Lemberg <wl@gnu.org>

    [smooth] Detect SSE2 with MSVC for x86
    
    MSVC does not set `__SSE2__`. Instead one must check whether `_M_IX86_FP` is
    defined and greater than or equal to 2.
    
    * src/smooth/ftgrays.c (FT_SSE2): New macro.
    Use it where appropriate.
---
 src/smooth/ftgrays.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index c550c33..576dbb3 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -999,10 +999,17 @@ typedef ptrdiff_t  FT_PtrDist;
    *
    * For other cases, using binary splits is actually slightly faster.
    */
-#if defined( __SSE2__ )    || \
-    defined( __x86_64__ )  || \
+#if defined( __SSE2__ )                          || \
+    defined( __x86_64__ )                        || \
+    defined( _M_AMD64 )                          || \
+    ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 )
+#  define FT_SSE2 1
+#else
+#  define FT_SSE2 0
+#endif
+
+#if FT_SSE2                || \
     defined( __aarch64__ ) || \
-    defined( _M_AMD64 )    || \
     defined( _M_ARM64 )
 #  define BEZIER_USE_DDA  1
 #else
@@ -1022,7 +1029,7 @@ typedef ptrdiff_t  FT_PtrDist;
 
 #if BEZIER_USE_DDA
 
-#ifdef __SSE2__
+#if FT_SSE2
 #  include <emmintrin.h>
 #endif
 
@@ -1135,7 +1142,7 @@ typedef ptrdiff_t  FT_PtrDist;
      *             = (B << (33 - N)) + (A << (32 - 2*N))
      */
 
-#ifdef __SSE2__
+#if FT_SSE2
     /* Experience shows that for small shift values, */
     /* SSE2 is actually slower.                      */
     if ( shift > 2 )
@@ -1192,7 +1199,7 @@ typedef ptrdiff_t  FT_PtrDist;
 
       return;
     }
-#endif  /* __SSE2__ */
+#endif  /* FT_SSE2 */
 
     rx = LEFT_SHIFT( ax, 33 - 2 * shift );
     ry = LEFT_SHIFT( ay, 33 - 2 * shift );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]