Skip to content

Commit

Permalink
Clean up macro names
Browse files Browse the repository at this point in the history
* Use VC_ as prefix for include guards
* Use a trailing underscore for include guards
* Use Vc_ as prefix for any other Vc macro (internal or part of the
public API)

Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Oct 20, 2015
1 parent dd9ff66 commit ed3869b
Show file tree
Hide file tree
Showing 176 changed files with 1,497 additions and 1,497 deletions.
2 changes: 1 addition & 1 deletion avx/casts.h
Expand Up @@ -77,7 +77,7 @@ namespace Casts
template<> Vc_INTRINSIC __m256d avx_cast(__m128i v) { return _mm256_castpd128_pd256(_mm_castsi128_pd(v)); }
template<> Vc_INTRINSIC __m256d avx_cast(__m128d v) { return _mm256_castpd128_pd256(v); }

#if defined VC_MSVC || defined VC_CLANG
#if defined Vc_MSVC || defined Vc_CLANG
static Vc_INTRINSIC Vc_CONST __m256 zeroExtend(__m128 v) { return _mm256_permute2f128_ps (_mm256_castps128_ps256(v), _mm256_castps128_ps256(v), 0x80); }
static Vc_INTRINSIC Vc_CONST __m256i zeroExtend(__m128i v) { return _mm256_permute2f128_si256(_mm256_castsi128_si256(v), _mm256_castsi128_si256(v), 0x80); }
static Vc_INTRINSIC Vc_CONST __m256d zeroExtend(__m128d v) { return _mm256_permute2f128_pd (_mm256_castpd128_pd256(v), _mm256_castpd128_pd256(v), 0x80); }
Expand Down
6 changes: 3 additions & 3 deletions avx/const.h
Expand Up @@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}}}*/

#ifndef VC_AVX_CONST_H
#define VC_AVX_CONST_H
#ifndef VC_AVX_CONST_H_
#define VC_AVX_CONST_H_

#include <cstddef>
#include "types.h"
Expand Down Expand Up @@ -120,4 +120,4 @@ using AVX::Const;

#include "undomacros.h"

#endif // VC_AVX_CONST_H
#endif // VC_AVX_CONST_H_
6 changes: 3 additions & 3 deletions avx/const_data.h
Expand Up @@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}}}*/

#ifndef VC_AVX_CONST_DATA_H
#define VC_AVX_CONST_DATA_H
#ifndef VC_AVX_CONST_DATA_H_
#define VC_AVX_CONST_DATA_H_

#include "../common/data.h"
#include "macros.h"
Expand Down Expand Up @@ -93,4 +93,4 @@ namespace AVX2

#include "undomacros.h"

#endif // VC_AVX_CONST_DATA_H
#endif // VC_AVX_CONST_DATA_H_
6 changes: 3 additions & 3 deletions avx/debug.h
Expand Up @@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}}}*/

#ifndef VC_AVX_DEBUG_H
#define VC_AVX_DEBUG_H
#ifndef VC_AVX_DEBUG_H_
#define VC_AVX_DEBUG_H_

#ifndef NDEBUG
#include "vector.h"
Expand Down Expand Up @@ -115,4 +115,4 @@ class DebugStream
} // namespace AVX
} // namespace Vc

#endif // VC_AVX_DEBUG_H
#endif // VC_AVX_DEBUG_H_
24 changes: 12 additions & 12 deletions avx/deinterleave.tcc
Expand Up @@ -31,7 +31,7 @@ namespace Vc_VERSIONED_NAMESPACE
namespace AVX2
{

inline void deinterleave(double_v &VC_RESTRICT a, double_v &VC_RESTRICT b, double_v &VC_RESTRICT c)
inline void deinterleave(double_v &Vc_RESTRICT a, double_v &Vc_RESTRICT b, double_v &Vc_RESTRICT c)
{ // estimated latency (AVX): 4.5 cycles
const m256d tmp0 = Mem::shuffle128<X0, Y1>(a.data(), b.data());
const m256d tmp1 = Mem::shuffle128<X1, Y0>(a.data(), c.data());
Expand All @@ -41,7 +41,7 @@ inline void deinterleave(double_v &VC_RESTRICT a, double_v &VC_RESTRICT b, doubl
c.data() = Mem::shuffle<X0, Y1, X2, Y3>(tmp1, tmp2);
}

inline void deinterleave(float_v &VC_RESTRICT a, float_v &VC_RESTRICT b, float_v &VC_RESTRICT c)
inline void deinterleave(float_v &Vc_RESTRICT a, float_v &Vc_RESTRICT b, float_v &Vc_RESTRICT c)
{
// abc abc abc
// a = [a0 b0 c0 a1 b1 c1 a2 b2] 332 = 211+121
Expand All @@ -62,20 +62,20 @@ inline void deinterleave(float_v &VC_RESTRICT a, float_v &VC_RESTRICT b, float_v
c.data() = Mem::permute<X2, X1, X0, X3>(tmp2);
}

inline void deinterleave(int_v &VC_RESTRICT a, int_v &VC_RESTRICT b, int_v &VC_RESTRICT c)
inline void deinterleave(int_v &Vc_RESTRICT a, int_v &Vc_RESTRICT b, int_v &Vc_RESTRICT c)
{
deinterleave(reinterpret_cast<float_v &>(a), reinterpret_cast<float_v &>(b),
reinterpret_cast<float_v &>(c));
}

inline void deinterleave(uint_v &VC_RESTRICT a, uint_v &VC_RESTRICT b, uint_v &VC_RESTRICT c)
inline void deinterleave(uint_v &Vc_RESTRICT a, uint_v &Vc_RESTRICT b, uint_v &Vc_RESTRICT c)
{
deinterleave(reinterpret_cast<float_v &>(a), reinterpret_cast<float_v &>(b),
reinterpret_cast<float_v &>(c));
}

inline void deinterleave(Vector<short> &VC_RESTRICT , Vector<short> &VC_RESTRICT ,
Vector<short> &VC_RESTRICT )
inline void deinterleave(Vector<short> &Vc_RESTRICT , Vector<short> &Vc_RESTRICT ,
Vector<short> &Vc_RESTRICT )
{
return;
/* TODO:
Expand All @@ -99,8 +99,8 @@ inline void deinterleave(Vector<short> &VC_RESTRICT , Vector<short> &VC_RESTRICT
*/
}

inline void deinterleave(Vector<unsigned short> &VC_RESTRICT a, Vector<unsigned short> &VC_RESTRICT b,
Vector<unsigned short> &VC_RESTRICT c)
inline void deinterleave(Vector<unsigned short> &Vc_RESTRICT a, Vector<unsigned short> &Vc_RESTRICT b,
Vector<unsigned short> &Vc_RESTRICT c)
{
deinterleave(reinterpret_cast<Vector<short> &>(a), reinterpret_cast<Vector<short> &>(b),
reinterpret_cast<Vector<short> &>(c));
Expand Down Expand Up @@ -275,10 +275,10 @@ inline void deinterleave(AVX2::ushort_v &a, AVX2::ushort_v &b, const unsigned sh

// only support M == V::EntryType -> no specialization
template <typename T, typename M, typename Flags>
Vc_ALWAYS_INLINE void deinterleave(AVX2::Vector<T> &VC_RESTRICT a,
AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c,
const M *VC_RESTRICT memory, Flags align)
Vc_ALWAYS_INLINE void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,
AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c,
const M *Vc_RESTRICT memory, Flags align)
{
using V = AVX2::Vector<T>;
a.load(&memory[0 * V::Size], align);
Expand Down
44 changes: 22 additions & 22 deletions avx/detail.h
Expand Up @@ -370,7 +370,7 @@ template<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<8, 16, __m256>(__m256i k)
}

// 16 -> 8
#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
template<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<16, 8, __m256>(__m256i k)
{
// abcd efgh ijkl mnop -> aabb ccdd eeff gghh
Expand Down Expand Up @@ -430,7 +430,7 @@ Vc_INTRINSIC __m256 xor_(__m256 a, __m256 b) { return _mm256_xor_ps(a, b); }
Vc_INTRINSIC __m256d xor_(__m256d a, __m256d b) { return _mm256_xor_pd(a, b); }
Vc_INTRINSIC __m256i xor_(__m256i a, __m256i b)
{
#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
return _mm256_xor_si256(a, b);
#else
return _mm256_castps_si256(
Expand All @@ -443,7 +443,7 @@ Vc_INTRINSIC __m256 or_(__m256 a, __m256 b) { return _mm256_or_ps(a, b); }
Vc_INTRINSIC __m256d or_(__m256d a, __m256d b) { return _mm256_or_pd(a, b); }
Vc_INTRINSIC __m256i or_(__m256i a, __m256i b)
{
#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
return _mm256_or_si256(a, b);
#else
return _mm256_castps_si256(
Expand All @@ -455,7 +455,7 @@ Vc_INTRINSIC __m256i or_(__m256i a, __m256i b)
Vc_INTRINSIC __m256 and_(__m256 a, __m256 b) { return _mm256_and_ps(a, b); }
Vc_INTRINSIC __m256d and_(__m256d a, __m256d b) { return _mm256_and_pd(a, b); }
Vc_INTRINSIC __m256i and_(__m256i a, __m256i b) {
#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
return _mm256_and_si256(a, b);
#else
return _mm256_castps_si256(
Expand All @@ -468,7 +468,7 @@ Vc_INTRINSIC __m256 andnot_(__m256 a, __m256 b) { return _mm256_andnot_ps(a, b);
Vc_INTRINSIC __m256d andnot_(__m256d a, __m256d b) { return _mm256_andnot_pd(a, b); }
Vc_INTRINSIC __m256i andnot_(__m256i a, __m256i b)
{
#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
return _mm256_andnot_si256(a, b);
#else
return _mm256_castps_si256(
Expand Down Expand Up @@ -598,9 +598,9 @@ Vc_INTRINSIC __m256i cmplt(__m256i a, __m256i b, uchar) { return AVX::cmpgt_epu

// fma{{{1
Vc_INTRINSIC void fma(__m256 &a, __m256 b, __m256 c, float) {
#ifdef VC_IMPL_FMA4
#ifdef Vc_IMPL_FMA4
a = _mm256_macc_ps(a, b, c);
#elif defined VC_IMPL_FMA
#elif defined Vc_IMPL_FMA
a = _mm256_fmadd_ps(a, b, c);
#else
using namespace AVX;
Expand All @@ -615,9 +615,9 @@ Vc_INTRINSIC void fma(__m256 &a, __m256 b, __m256 c, float) {
#endif
}
Vc_INTRINSIC void fma(__m256d &a, __m256d b, __m256d c, double) {
#ifdef VC_IMPL_FMA4
#ifdef Vc_IMPL_FMA4
a = _mm256_macc_pd(a, b, c);
#elif defined VC_IMPL_FMA
#elif defined Vc_IMPL_FMA
a = _mm256_fmadd_pd(a, b, c);
#else
using namespace AVX;
Expand Down Expand Up @@ -694,17 +694,17 @@ Vc_INTRINSIC __m256i avx_broadcast( uchar x) { return _mm256_set1_epi8(x); }
// sorted{{{1
template <Vc::Implementation Impl, typename T,
typename = enable_if<(Impl >= AVXImpl && Impl <= AVX2Impl)>>
Vc_CONST_L AVX2::Vector<T> sorted(VC_ALIGNED_PARAMETER(AVX2::Vector<T>) x) Vc_CONST_R;
Vc_CONST_L AVX2::Vector<T> sorted(Vc_ALIGNED_PARAMETER(AVX2::Vector<T>) x) Vc_CONST_R;
template <typename T>
Vc_INTRINSIC Vc_CONST AVX2::Vector<T> sorted(VC_ALIGNED_PARAMETER(AVX2::Vector<T>) x)
Vc_INTRINSIC Vc_CONST AVX2::Vector<T> sorted(Vc_ALIGNED_PARAMETER(AVX2::Vector<T>) x)
{
return sorted<CurrentImplementation::current()>(x);
}

// shifted{{{1
template <typename T, typename V>
static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32), V> shifted(
VC_ALIGNED_PARAMETER(V) v, int amount)
Vc_ALIGNED_PARAMETER(V) v, int amount)
{
using namespace AVX;
constexpr int S = sizeof(T);
Expand Down Expand Up @@ -790,7 +790,7 @@ static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32), V> shifted(

template <typename T, typename V>
static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 16), V> shifted(
VC_ALIGNED_PARAMETER(V) v, int amount)
Vc_ALIGNED_PARAMETER(V) v, int amount)
{
using namespace AVX;
switch (amount) {
Expand Down Expand Up @@ -819,7 +819,7 @@ static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 16), V> shifted(
// rotated{{{1
template <typename T, size_t N, typename V>
static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 4), V> rotated(
VC_ALIGNED_PARAMETER(V) v, int amount)
Vc_ALIGNED_PARAMETER(V) v, int amount)
{
using namespace AVX;
const __m128i vLo = avx_cast<__m128i>(lo128(v));
Expand All @@ -841,7 +841,7 @@ static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 4), V> rotated(

template <typename T, size_t N, typename V>
static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 8), V> rotated(
VC_ALIGNED_PARAMETER(V) v, int amount)
Vc_ALIGNED_PARAMETER(V) v, int amount)
{
using namespace AVX;
const __m128i vLo = avx_cast<__m128i>(lo128(v));
Expand Down Expand Up @@ -873,10 +873,10 @@ static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 8), V> rotated(
return avx_cast<V>(_mm256_setzero_ps());
}

#ifdef VC_IMPL_AVX2
#ifdef Vc_IMPL_AVX2
template <typename T, size_t N, typename V>
static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 16), V> rotated(
VC_ALIGNED_PARAMETER(V) v, int amount)
Vc_ALIGNED_PARAMETER(V) v, int amount)
{
using namespace AVX;
const __m128i vLo = avx_cast<__m128i>(lo128(v));
Expand Down Expand Up @@ -929,7 +929,7 @@ static Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 16), V> rotated(
}
return avx_cast<V>(_mm256_setzero_ps());
}
#endif // VC_IMPL_AVX2
#endif // Vc_IMPL_AVX2

// testc{{{1
Vc_INTRINSIC Vc_CONST int testc(__m128 a, __m128 b) { return _mm_testc_si128(_mm_castps_si128(a), _mm_castps_si128(b)); }
Expand Down Expand Up @@ -1070,7 +1070,7 @@ template <> Vc_INTRINSIC Vc_CONST int mask_to_int<8>(__m256i k)
{
return movemask(AVX::avx_cast<__m256>(k));
}
#ifdef VC_IMPL_BMI2
#ifdef Vc_IMPL_BMI2
template <> Vc_INTRINSIC Vc_CONST int mask_to_int<16>(__m256i k)
{
return _pext_u32(movemask(k), 0x55555555u);
Expand Down Expand Up @@ -1484,7 +1484,7 @@ template<typename V> struct InterleaveImpl<V, 8, 32> {
const typename V::AsArg v0, const typename V::AsArg v1, const typename V::AsArg v2)
{
using namespace AVX;
#ifdef VC_USE_MASKMOV_SCATTER
#ifdef Vc_USE_MASKMOV_SCATTER
// [0a 2a 0b 2b 0e 2e 0f 2f]:
const m256 tmp0 = _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));
// [0c 2c 0d 2d 0g 2g 0h 2h]:
Expand Down Expand Up @@ -1692,13 +1692,13 @@ template<typename V> struct InterleaveImpl<V, 4, 32> {
const typename V::AsArg v0, const typename V::AsArg v1, const typename V::AsArg v2)
{
using namespace AVX;
#ifdef VC_USE_MASKMOV_SCATTER
#ifdef Vc_USE_MASKMOV_SCATTER
const m256d tmp0 = _mm256_unpacklo_pd(v0.data(), v1.data());
const m256d tmp1 = _mm256_unpackhi_pd(v0.data(), v1.data());
const m256d tmp2 = _mm256_unpacklo_pd(v2.data(), v2.data());
const m256d tmp3 = _mm256_unpackhi_pd(v2.data(), v2.data());

#if defined(VC_MSVC) && (VC_MSVC < 170000000 || !defined(_WIN64))
#if defined(Vc_MSVC) && (Vc_MSVC < 170000000 || !defined(_WIN64))
// MSVC needs to be at Version 2012 before _mm256_set_epi64x works
const m256i mask = concat(_mm_setallone_si128(), _mm_set_epi32(0, 0, -1, -1));
#else
Expand Down
54 changes: 27 additions & 27 deletions avx/helperimpl.h
Expand Up @@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}}}*/

#ifndef VC_AVX_HELPERIMPL_H
#define VC_AVX_HELPERIMPL_H
#ifndef VC_AVX_HELPERIMPL_H_
#define VC_AVX_HELPERIMPL_H_

#include "sse/helperimpl.h"
#include "macros.h"
Expand Down Expand Up @@ -58,39 +58,39 @@ template <typename A>
inline void deinterleave(AVX2::ushort_v &, AVX2::ushort_v &, const ushort *, A);

template <typename T, typename M, typename A>
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &VC_RESTRICT a,
AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c,
const M *VC_RESTRICT memory,
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,
AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c,
const M *Vc_RESTRICT memory,
A align) Vc_ALWAYS_INLINE_R;
template <typename T, typename M, typename A>
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &VC_RESTRICT a,
AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c,
AVX2::Vector<T> &VC_RESTRICT d,
const M *VC_RESTRICT memory,
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,
AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c,
AVX2::Vector<T> &Vc_RESTRICT d,
const M *Vc_RESTRICT memory,
A align) Vc_ALWAYS_INLINE_R;
template <typename T, typename M, typename A>
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &VC_RESTRICT a,
AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c,
AVX2::Vector<T> &VC_RESTRICT d,
AVX2::Vector<T> &VC_RESTRICT e,
const M *VC_RESTRICT memory,
Vc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,
AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c,
AVX2::Vector<T> &Vc_RESTRICT d,
AVX2::Vector<T> &Vc_RESTRICT e,
const M *Vc_RESTRICT memory,
A align) Vc_ALWAYS_INLINE_R;
template <typename T, typename M, typename A>
Vc_ALWAYS_INLINE_L void deinterleave(
AVX2::Vector<T> &VC_RESTRICT a, AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c, AVX2::Vector<T> &VC_RESTRICT d,
AVX2::Vector<T> &VC_RESTRICT e, AVX2::Vector<T> &VC_RESTRICT f,
const M *VC_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;
AVX2::Vector<T> &Vc_RESTRICT a, AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c, AVX2::Vector<T> &Vc_RESTRICT d,
AVX2::Vector<T> &Vc_RESTRICT e, AVX2::Vector<T> &Vc_RESTRICT f,
const M *Vc_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;
template <typename T, typename M, typename A>
Vc_ALWAYS_INLINE_L void deinterleave(
AVX2::Vector<T> &VC_RESTRICT a, AVX2::Vector<T> &VC_RESTRICT b,
AVX2::Vector<T> &VC_RESTRICT c, AVX2::Vector<T> &VC_RESTRICT d,
AVX2::Vector<T> &VC_RESTRICT e, AVX2::Vector<T> &VC_RESTRICT f,
AVX2::Vector<T> &VC_RESTRICT g, AVX2::Vector<T> &VC_RESTRICT h,
const M *VC_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;
AVX2::Vector<T> &Vc_RESTRICT a, AVX2::Vector<T> &Vc_RESTRICT b,
AVX2::Vector<T> &Vc_RESTRICT c, AVX2::Vector<T> &Vc_RESTRICT d,
AVX2::Vector<T> &Vc_RESTRICT e, AVX2::Vector<T> &Vc_RESTRICT f,
AVX2::Vector<T> &Vc_RESTRICT g, AVX2::Vector<T> &Vc_RESTRICT h,
const M *Vc_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;

Vc_ALWAYS_INLINE void prefetchForOneRead(const void *addr, VectorAbi::Avx)
{
Expand Down Expand Up @@ -118,4 +118,4 @@ Vc_ALWAYS_INLINE void prefetchFar(const void *addr, VectorAbi::Avx)
#include "deinterleave.tcc"
#include "undomacros.h"

#endif // VC_AVX_HELPERIMPL_H
#endif // VC_AVX_HELPERIMPL_H_

0 comments on commit ed3869b

Please sign in to comment.