Skip to content

Commit

Permalink
AVX-512: Added AVX-512 intrinsics and tests
Browse files Browse the repository at this point in the history
by Asaf Badouh (asaf.badouh@intel.com)

llvm-svn: 236218
  • Loading branch information
Elena Demikhovsky committed Apr 30, 2015
1 parent e9f5357 commit e7d4c2e
Show file tree
Hide file tree
Showing 7 changed files with 1,018 additions and 0 deletions.
27 changes: 27 additions & 0 deletions clang/include/clang/Basic/BuiltinsX86.def
Original file line number Diff line number Diff line change
Expand Up @@ -1018,5 +1018,32 @@ BUILTIN(__builtin_ia32_psubq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "")
BUILTIN(__builtin_ia32_paddd512_mask, "V16iV16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_psubd512_mask, "V16iV16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_pmulld512_mask, "V16iV16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_pmullq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "")
BUILTIN(__builtin_ia32_xorpd512_mask, "V8dV8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_xorps512_mask, "V16fV16fV16fV16fUs", "")
BUILTIN(__builtin_ia32_orpd512_mask, "V8dV8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_orps512_mask, "V16fV16fV16fV16fUs", "")
BUILTIN(__builtin_ia32_andpd512_mask, "V8dV8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_andps512_mask, "V16fV16fV16fV16fUs", "")
BUILTIN(__builtin_ia32_andnpd512_mask, "V8dV8dV8dV8dUc", "")
BUILTIN(__builtin_ia32_andnps512_mask, "V16fV16fV16fV16fUs", "")
BUILTIN(__builtin_ia32_pmullq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "")
BUILTIN(__builtin_ia32_pmullq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "")
BUILTIN(__builtin_ia32_andnpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_andnpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_andnps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_andnps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_andpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_andpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_andps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_andps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_xorpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_xorpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_xorps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_xorps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_orpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_orpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_orps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_orps128_mask, "V4fV4fV4fV4fUc", "")

#undef BUILTIN
2 changes: 2 additions & 0 deletions clang/lib/Headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set(files
avx512fintrin.h
avx512vlbwintrin.h
avx512vlintrin.h
avx512dqintrin.h
avx512vldqintrin.h
avxintrin.h
bmi2intrin.h
bmiintrin.h
Expand Down
237 changes: 237 additions & 0 deletions clang/lib/Headers/avx512dqintrin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
/*===---- avx512dqintrin.h - AVX512DQ intrinsics ---------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/

#ifndef __IMMINTRIN_H
#error "Never use <avx512dqintrin.h> directly; include <immintrin.h> instead."
#endif

#ifndef __AVX512DQINTRIN_H
#define __AVX512DQINTRIN_H

static __inline__ __m512i __attribute__ ((__always_inline__, __nodebug__))
_mm512_mullo_epi64 (__m512i __A, __m512i __B) {
return (__m512i) ((__v8di) __A * (__v8di) __B);
}

static __inline__ __m512i __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_mullo_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
return (__m512i) __builtin_ia32_pmullq512_mask ((__v8di) __A,
(__v8di) __B,
(__v8di) __W,
(__mmask8) __U);
}

static __inline__ __m512i __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_mullo_epi64 (__mmask8 __U, __m512i __A, __m512i __B) {
return (__m512i) __builtin_ia32_pmullq512_mask ((__v8di) __A,
(__v8di) __B,
(__v8di)
_mm512_setzero_si512 (),
(__mmask8) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_xor_pd (__m512d __A, __m512d __B) {
return (__m512d) ((__v8di) __A ^ (__v8di) __B);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_xor_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_xorpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df) __W,
(__mmask8) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_xor_pd (__mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_xorpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df)
_mm512_setzero_pd (),
(__mmask8) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_xor_ps (__m512 __A, __m512 __B) {
return (__m512) ((__v16si) __A ^ (__v16si) __B);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_xor_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_xorps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf) __W,
(__mmask16) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_xor_ps (__mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_xorps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf)
_mm512_setzero_ps (),
(__mmask16) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_or_pd (__m512d __A, __m512d __B) {
return (__m512d) ((__v8di) __A | (__v8di) __B);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_or_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_orpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df) __W,
(__mmask8) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_or_pd (__mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_orpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df)
_mm512_setzero_pd (),
(__mmask8) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_or_ps (__m512 __A, __m512 __B) {
return (__m512) ((__v16si) __A | (__v16si) __B);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_or_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_orps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf) __W,
(__mmask16) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_or_ps (__mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_orps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf)
_mm512_setzero_ps (),
(__mmask16) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_and_pd (__m512d __A, __m512d __B) {
return (__m512d) ((__v8di) __A & (__v8di) __B);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_and_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_andpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df) __W,
(__mmask8) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_and_pd (__mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_andpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df)
_mm512_setzero_pd (),
(__mmask8) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_and_ps (__m512 __A, __m512 __B) {
return (__m512) ((__v16si) __A & (__v16si) __B);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_and_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_andps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf) __W,
(__mmask16) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_and_ps (__mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_andps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf)
_mm512_setzero_ps (),
(__mmask16) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_andnot_pd (__m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df)
_mm512_setzero_pd (),
(__mmask8) -1);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_andnot_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df) __W,
(__mmask8) __U);
}

static __inline__ __m512d __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_andnot_pd (__mmask8 __U, __m512d __A, __m512d __B) {
return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
(__v8df) __B,
(__v8df)
_mm512_setzero_pd (),
(__mmask8) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_andnot_ps (__m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf)
_mm512_setzero_ps (),
(__mmask16) -1);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_mask_andnot_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf) __W,
(__mmask16) __U);
}

static __inline__ __m512 __attribute__ ((__always_inline__, __nodebug__))
_mm512_maskz_andnot_ps (__mmask16 __U, __m512 __A, __m512 __B) {
return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
(__v16sf) __B,
(__v16sf)
_mm512_setzero_ps (),
(__mmask16) __U);
}

#endif

0 comments on commit e7d4c2e

Please sign in to comment.