Fix build with clang, remove USE_GCC line in Makefile

Submitted by:	Roman Cat <roman-cat@yandex.ru> (modified version)
This commit is contained in:
Rene Ladan 2013-08-06 12:06:19 +00:00
parent 1368c39c3a
commit c1883ed2a6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=324311
5 changed files with 120 additions and 1 deletions

View file

@ -22,7 +22,6 @@ USES= gmake pkgconfig
USE_XZ= yes
USE_AUTOTOOLS= autoconf:env automake:env
GNU_CONFIGURE= yes
USE_GCC= any
CFLAGS+= -O2 -I${LOCALBASE}/include/boinc -I${LOCALBASE}/include \
-L${LOCALBASE}/lib

View file

@ -0,0 +1,35 @@
--- client/vector/analyzeFuncs_sse.cpp.origin 2013-08-02 01:08:24.000000000 +0400
+++ client/vector/analyzeFuncs_sse.cpp 2013-08-02 01:18:33.000000000 +0400
@@ -191,7 +191,7 @@
prefetcht0(out+3*yline);
// TODO: figure out why the intrinsic version crashes for MinGW build
// not critical, but shuffle-only _MM_TRANSPOSE4_PS is optimal on some
-#if defined(USE_INTRINSICS) && defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__)
+#if defined(USE_INTRINSICS) && (defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__) || defined(__clang__))
register float4 row0=*(__m128 *)in;
register float4 row1=*(__m128 *)(in+xline);
register float4 row2=*(__m128 *)(in+2*xline);
@@ -273,7 +273,7 @@
// TODO: figure out why the intrinsic version crashes for MinGW build
// not critical, but the shuffle-only _MM_TRANSPOSE4_PS is optimal on some
-#if defined(USE_INTRINSICS) && defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__)
+#if defined(USE_INTRINSICS) && (defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__) || defined(__clang__))
register float4 row0=*(__m128 *)in;
register float4 row1=*(__m128 *)(in+xline);
register float4 row2=*(__m128 *)(in+2*xline);
@@ -1592,8 +1592,14 @@
return ( tMax );
}
+#ifdef __clang__
+#define s_getU( aaaa, ptr ) \
+ aaaa = _mm_loadl_pi(aaaa, (__m64 *)ptr); \
+ aaaa = _mm_loadh_pi(aaaa, ((__m64 *)(ptr))+1 )
+#else
#define s_getU( aaaa, ptr ) \
aaaa = _mm_loadh_pi( _mm_loadl_pi(aaaa, (__m64 *)ptr), ((__m64 *)(ptr))+1 )
+#endif
#define s_putU( ptr, aaaa ) \
_mm_storel_pi((__m64 *)ptr, aaaa), _mm_storeh_pi( ((__m64 *)ptr)+1 , aaaa)

View file

@ -0,0 +1,17 @@
--- client/vector/analyzeFuncs_x86_64.cpp.orig 2011-04-03 07:25:53.000000000 +0200
+++ client/vector/analyzeFuncs_x86_64.cpp 2013-07-29 17:41:37.000000000 +0200
@@ -61,8 +61,14 @@
static const int as [4] __attribute__((aligned(16)))= {INT_MIN, 0, INT_MIN, 0} ; // {-, +, -, +}
char *cblock = (char *)alloca(11*16);
cblock+=(16-((ssize_t)cblock % 16));
+#ifdef __clang__
+ __m128 *fblock=reinterpret_cast<__m128 *>(cblock);
+ __m128d *dblock=reinterpret_cast<__m128d *>(cblock);
+#else
x86_m128 *fblock=reinterpret_cast<x86_m128 *>(cblock);
x86_m128d *dblock=reinterpret_cast<x86_m128d *>(cblock);
+#endif
+
#define CC dblock[0]
#define DD dblock[1]
#define cc fblock[2]

View file

@ -0,0 +1,25 @@
--- client/vector/x86_float4.h.orig 2011-05-22 21:08:50.000000000 +0200
+++ client/vector/x86_float4.h 2013-07-29 18:52:18.000000000 +0200
@@ -58,11 +58,15 @@
ALIGNED(static const int sign_bits[4],16)={INT_MIN, INT_MIN, INT_MIN, INT_MIN};
ALIGNED(static const int other_bits[4],16)={INT_MAX, INT_MAX, INT_MAX, INT_MAX};
+
+#ifdef __clang__
+#ifndef __EMMINTRIN_H
+typedef long long __m128i __attribute__((__vector_size__(16)));
+#endif
+#endif
#define SIGN_BITS (*(__m128i *)sign_bits)
#define OTHER_BITS (*(__m128i *)other_bits)
-
-
struct float4 {
float4() {};
float4(const __m128 b) { m=b; };
@@ -263,4 +267,3 @@
#endif
#endif
-

View file

@ -0,0 +1,43 @@
--- client/vector/x86_ops.h.orig 2011-05-22 21:08:50.000000000 +0200
+++ client/vector/x86_ops.h 2013-07-29 17:42:54.000000000 +0200
@@ -135,7 +135,11 @@
#if defined(__SSE2__)
// SSE2 specific functions/macros here.
-#ifdef _MSC_VER
+#ifdef __clang__
+#ifndef __EMMINTRIN_H
+#include <emmintrin.h>
+#endif
+#elif defined _MSC_VER
typedef __m128d x86_m128d;
#else
typedef double x86_m128d __attribute__ ((mode(V2DF))) __attribute__((aligned(16)));
@@ -144,7 +148,11 @@
#if defined(__SSE__)
// SSE specific functions/macros here.
-#ifdef _MSC_VER
+#ifdef __clang__
+#ifndef __XMMINTRIN_H
+#include <xmmintrin.h>
+#endif
+#elif defined _MSC_VER
typedef __m128 x86_m128;
typedef __m128i x86_m128i;
#else
@@ -186,6 +194,7 @@
#endif
+#ifndef __clang__
#ifndef __m128d
#define __m128d x86_m128d
#endif
@@ -197,5 +206,6 @@
#ifndef __m128
#define __m128 x86_m128
#endif
+#endif
#endif