Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2015 01:45:09 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r402466 - in head/graphics/seexpr: . files
Message-ID:  <201511270145.tAR1j9vu032838@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Fri Nov 27 01:45:08 2015
New Revision: 402466
URL: https://svnweb.freebsd.org/changeset/ports/402466

Log:
  Do not unconditionally use SSE4.1 code: not just it makes it less portable,
  it might crash on CPUs that do not support those instructions, with SIGILL.

Added:
  head/graphics/seexpr/files/
  head/graphics/seexpr/files/patch-CMakeLists.txt   (contents, props changed)
  head/graphics/seexpr/files/patch-src_SeExpr_SeNoise.cpp   (contents, props changed)
Modified:
  head/graphics/seexpr/Makefile

Modified: head/graphics/seexpr/Makefile
==============================================================================
--- head/graphics/seexpr/Makefile	Thu Nov 26 22:43:21 2015	(r402465)
+++ head/graphics/seexpr/Makefile	Fri Nov 27 01:45:08 2015	(r402466)
@@ -3,6 +3,7 @@
 
 PORTNAME=	seexpr
 DISTVERSION=	1.0.1.2015.08.29
+PORTREVISION=	1
 CATEGORIES=	graphics math
 
 MAINTAINER=	danfe@FreeBSD.org
@@ -23,6 +24,10 @@ WRKSRC=		${WRKDIR}/SeExpr-${GH_TAGNAME_E
 
 CXXFLAGS+=	-I${LOCALBASE}/include
 
+.if ${MACHINE_CPU:Msse41}
+CMAKE_ARGS+=	-DUSE_SSE41:BOOL=ON
+.endif
+
 .include <bsd.port.pre.mk>
 
 # base flex(1) v2.5.4 is not sufficient
@@ -33,7 +38,6 @@ BUILD_DEPENDS+=	${LOCALBASE}/bin/flex:${
 post-patch:
 	@${REINPLACE_CMD} -e '/<alloca\.h>/d' ${WRKSRC}/src/SeExpr/SePlatform.h
 	@${REINPLACE_CMD} -e 's, "dl",,' ${WRKSRC}/src/SeExpr/CMakeLists.txt
-	@${REINPLACE_CMD} -e '/tests/d' ${WRKSRC}/CMakeLists.txt
 .if ${OSVERSION} < 1000033
 	@${REINPLACE_CMD} -e '/COMMAND/s,flex,${LOCALBASE}/bin/&,' \
 		${WRKSRC}/src/build/macros.cmake

Added: head/graphics/seexpr/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/seexpr/files/patch-CMakeLists.txt	Fri Nov 27 01:45:08 2015	(r402466)
@@ -0,0 +1,19 @@
+--- CMakeLists.txt.orig	2015-08-28 22:32:38 UTC
++++ CMakeLists.txt
+@@ -46,7 +46,10 @@ ELSE(WIN32)
+   ADD_DEFINITIONS (-Wall  -Wextra)
+   ADD_DEFINITIONS (-pthread)
+ 
+-  SET( CMAKE_CXX_FLAGS "-fPIC -msse4.1")
++  SET( CMAKE_CXX_FLAGS -fPIC )
++  IF(USE_SSE41)
++    SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
++  ENDIF()
+ ENDIF(WIN32)
+ 
+ ## Choose build options
+@@ -99,4 +102,3 @@ ADD_SUBDIRECTORY (src/SeExpr)
+ ADD_SUBDIRECTORY (src/SeExprEditor)
+ ADD_SUBDIRECTORY (src/doc)
+ ADD_SUBDIRECTORY (src/demos)
+-ADD_SUBDIRECTORY (src/tests)

Added: head/graphics/seexpr/files/patch-src_SeExpr_SeNoise.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/seexpr/files/patch-src_SeExpr_SeNoise.cpp	Fri Nov 27 01:45:08 2015	(r402466)
@@ -0,0 +1,34 @@
+--- src/SeExpr/SeNoise.cpp.orig	2015-08-28 22:32:38 UTC
++++ src/SeExpr/SeNoise.cpp
+@@ -16,7 +16,9 @@
+ */
+ 
+ #include <iostream>
++#ifdef __SSE4_1__
+ #include <smmintrin.h>
++#endif
+ 
+ #include "SeExprBuiltins.h"
+ namespace{
+@@ -25,14 +27,18 @@ namespace{
+ #include "SeNoise.h"
+ namespace SeExpr{
+ 
++#ifdef __SSE4_1__
+ inline double floorSSE(double val) {
+-    return _mm_cvtsd_f64(_mm_floor_sd(_mm_set_sd(0.0), _mm_set_sd(val)));
++    return _mm_floor_sd(_mm_set_sd(0.0), _mm_set_sd(val))[0];
+ }
+ 
+ inline double roundSSE(double val) {
+-    return _mm_cvtsd_f64(_mm_round_sd(_mm_set_sd(0.0), _mm_set_sd(val), _MM_FROUND_TO_NEAREST_INT));
++    return _mm_round_sd(_mm_set_sd(0.0), _mm_set_sd(val), _MM_FROUND_TO_NEAREST_INT)[0];
+ }
+-
++#else
++#define floorSSE floor
++#define roundSSE round
++#endif
+ 
+ //! This is the Quintic interpolant from Perlin's Improved Noise Paper
+ double s_curve(double t) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511270145.tAR1j9vu032838>