vxl (1.14.0-18) sse2.patch

Summary

 core/vil/vil_round.h |    3 ++-
 core/vnl/vnl_math.h  |   18 +++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

    
download this patch

Patch contents

From: Tom Vercauteren <tom.vercauteren@gmail.com>
Date: Tue, 19 May 2009 09:29:23 -0400
Subject: [PATCH] COMP: Use vanilla implementation in rounding function when gcc-xml is used

---
 Utilities/vxl/core/vnl/vnl_math.h |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
Origin: vendor, http://itk.org/gitweb?p=ITK.git;a=commit;h=b106984
Last-Update: 2012-12-20

Index: vxl-1.14.0/core/vnl/vnl_math.h
===================================================================
--- vxl-1.14.0.orig/core/vnl/vnl_math.h	2009-11-21 16:45:28.000000000 +0100
+++ vxl-1.14.0/core/vnl/vnl_math.h	2011-04-19 12:55:21.000000000 +0200
@@ -44,16 +44,20 @@
 #endif
 
 // Figure out when the fast implementation can be used
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING
+#if VNL_CONFIG_ENABLE_SSE2_ROUNDING && defined(__SSE2__)
 # if !VXL_HAS_EMMINTRIN_H
 #   error "Required file emmintrin.h for SSE2 not found"
 # else
 #   include <emmintrin.h> // sse 2 intrinsics
+#   define USE_SSE2_IMPL 1
 # endif
+#else
+# define USE_SSE2_IMPL 0
 #endif
 // Turn on fast impl when using GCC on Intel-based machines with the following exception:
 //   PPC with Mac OS X
-#if defined(__GNUC__) && (!defined(__APPLE__)  || !defined(__ppc__) )
+//   GCCXML
+#if defined(__GNUC__) && (defined(__i386__) || defined(__i386) || defined(__x86_64__) || defined(__x86_64)) && (!defined(__APPLE__)  || !defined(__ppc__) )
 # define GCC_USE_FAST_IMPL 1
 #else
 # define GCC_USE_FAST_IMPL 0
@@ -184,7 +188,7 @@
 // We assume that the rounding mode is not changed from the default
 // one (or at least that it is always restored to the default one).
 
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING // Fast sse2 implementation
+#if USE_SSE2_IMPL // Fast sse2 implementation
 
 inline int vnl_math_rnd_halfinttoeven(float  x)
 {
@@ -295,7 +299,7 @@
 // We also assume that the rounding mode is not changed from the default
 // one (or at least that it is always restored to the default one).
 
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING || GCC_USE_FAST_IMPL || VC_USE_FAST_IMPL
+#if USE_SSE2_IMPL || GCC_USE_FAST_IMPL || VC_USE_FAST_IMPL
 
 inline int vnl_math_rnd_halfintup(float  x) { return vnl_math_rnd_halfinttoeven(2*x+0.5f)>>1; }
 inline int vnl_math_rnd_halfintup(double  x) { return vnl_math_rnd_halfinttoeven(2*x+0.5)>>1; }
@@ -328,7 +332,7 @@
 // We assume that the rounding mode is not changed from the default
 // one (or at least that it is always restored to the default one).
 
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING || GCC_USE_FAST_IMPL || VC_USE_FAST_IMPL
+#if  USE_SSE2_IMPL || GCC_USE_FAST_IMPL || VC_USE_FAST_IMPL
 
 inline int vnl_math_rnd(float  x) { return vnl_math_rnd_halfinttoeven(x); }
 inline int vnl_math_rnd(double  x) { return vnl_math_rnd_halfinttoeven(x); }
@@ -350,7 +354,7 @@
 // We also assume that the rounding mode is not changed from the default
 // one (or at least that it is always restored to the default one).
 
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING // Fast sse2 implementation
+#if  USE_SSE2_IMPL // Fast sse2 implementation
 
 inline int vnl_math_floor(float  x)
 {
@@ -435,7 +439,7 @@
 // We also assume that the rounding mode is not changed from the default
 // one (or at least that it is always restored to the default one).
 
-#if VNL_CONFIG_ENABLE_SSE2_ROUNDING // Fast sse2 implementation
+#if  USE_SSE2_IMPL // Fast sse2 implementation
 
 inline int vnl_math_ceil(float  x)
 {
Index: vxl-1.14.0/core/vil/vil_round.h
===================================================================
--- vxl-1.14.0.orig/core/vil/vil_round.h	2011-04-19 12:56:23.000000000 +0200
+++ vxl-1.14.0/core/vil/vil_round.h	2011-04-19 12:56:15.000000000 +0200
@@ -25,9 +25,10 @@
 # endif
 #endif
 
+#define DEFINED_INTEL    (defined(__i386__) || defined(__x86_64__))
 // Turn on fast impl when using GCC on Intel-based machines with the following exception:
 //   PPC with Mac OS X
-#if defined(__GNUC__) && (!defined(__APPLE__)  || !defined(__ppc__) )
+#if defined(__GNUC__) && DEFINED_INTEL
 # define GCC_USE_FAST_IMPL 1
 #else
 # define GCC_USE_FAST_IMPL 0