From 80736b6e3754af935d3a86afc9ad9bd0103b5e51 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 26 Nov 2013 16:57:36 -0500 Subject: vec_builtin is only for Clang --- vec_builtin.h | 51 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/vec_builtin.h b/vec_builtin.h index 4f8ad63..1933468 100644 --- a/vec_builtin.h +++ b/vec_builtin.h @@ -18,12 +18,6 @@ -#ifndef __has_builtin -# define __has_builtin(x) 0 // Compatibility with non-clang compilers -#endif - - - namespace vecmathlib { template struct boolbuiltinvec; @@ -41,8 +35,7 @@ namespace vecmathlib { static const int size = N; typedef bool scalar_t; - // typedef int_t bvector_t __attribute__((__ext_vector_type__(N))); - typedef int_t bvector_t __attribute__((__vector_size__(N * sizeof(T)))); + typedef int_t bvector_t __attribute__((__ext_vector_type__(N))); static const int alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), @@ -137,10 +130,8 @@ namespace vecmathlib { static const int size = N; typedef int_t scalar_t; - // typedef int_t ivector_t __attribute__((__ext_vector_type__(N))); - // typedef uint_t uvector_t __attribute__((__ext_vector_type__(N))); - typedef int_t ivector_t __attribute__((__vector_size__(N * sizeof(T)))); - typedef uint_t uvector_t __attribute__((__vector_size__(N * sizeof(T)))); + typedef int_t ivector_t __attribute__((__ext_vector_type__(N))); + typedef uint_t uvector_t __attribute__((__ext_vector_type__(N))); static const int alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), @@ -327,8 +318,7 @@ namespace vecmathlib { static const int size = N; typedef real_t scalar_t; - // typedef real_t vector_t __attribute__((__ext_vector_type__(N))); - typedef real_t vector_t __attribute__((__vector_size__(N * sizeof(T)))); + typedef real_t vector_t __attribute__((__ext_vector_type__(N))); static const int alignment = sizeof(vector_t); static_assert(size * sizeof(real_t) == sizeof(vector_t), @@ -345,37 +335,8 @@ namespace vecmathlib { } return name_.c_str(); } + void barrier() { volatile vector_t x __attribute__((__unused__)) = v; } #endif - void barrier() { -#if defined __GNUC__ && !defined __clang__ && !defined __ICC - // GCC crashes when +X is used as constraint -# if defined __SSE2__ - for (int d=0; d boolvec_t; typedef intbuiltinvec intvec_t; @@ -467,7 +428,7 @@ namespace vecmathlib { static realvec_t loada(const real_t* p) { VML_ASSERT(intptr_t(p) % alignment == 0); -#if defined __gcc__ || __has_builtin(__builtin_assume_aligned) +#if __has_builtin(__builtin_assume_aligned) p = (const real_t*)__builtin_assume_aligned(p, sizeof(realvec_t)); #endif return mkvec(*(const vector_t*)p); -- cgit v1.1