Skip to content

Commit

Permalink
Clang: work around bogus warnings
Browse files Browse the repository at this point in the history
Clang apparently doesn't expect the immediate to the permute intrinsics
to use 8 bits, otherwise it would use 'unsigned char' for the imm8
argument. Thus any value above 0x7f produces a warning. Work around the
warning by redefining the _mm256_permute2x128_si256,
_mm256_permute2f128_ps, and _mm256_permute2f128_si256 macros.

Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Jan 19, 2017
1 parent 1d7681c commit 08ac7ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions avx/intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ extern "C" {
#include "macros.h"
#include <cstdlib>

#if (defined Vc_CLANG && Vc_CLANG >= 0x30900)
#ifdef _mm256_permute2f128_si256
#undef _mm256_permute2f128_si256
#define _mm256_permute2f128_si256(V1, V2, M) __extension__ ({ \
(__m256i)__builtin_ia32_vperm2f128_si256((__v8si)(__m256i)(V1), \
(__v8si)(__m256i)(V2), (char)(M)); })
#endif

#ifdef _mm256_permute2f128_ps
#undef _mm256_permute2f128_ps
#define _mm256_permute2f128_ps(V1, V2, M) __extension__ ({ \
(__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)(__m256)(V1), \
(__v8sf)(__m256)(V2), (char)(M)); })
#endif

#ifdef _mm256_permute2x128_si256
#undef _mm256_permute2x128_si256
#define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \
(__m256i)__builtin_ia32_permti256((__m256i)(V1), (__m256i)(V2), (char)(M)); })
#endif
#endif

namespace Vc_VERSIONED_NAMESPACE
{
namespace AvxIntrinsics
Expand Down

0 comments on commit 08ac7ad

Please sign in to comment.