1/* 2 * Copyright (C) 2018 the FFLAS-FFPACK group 3 * 4 * Written by Ozturk Ozden<ozden.ozturk@etu.univ-grenoble-alpes.fr> 5 * 6 * 7 * ========LICENCE======== 8 * This file is part of the library FFLAS-FFPACK. 9 * 10 * FFLAS-FFPACK is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 * ========LICENCE======== 24 *. 25 */ 26 27 28#ifndef __FFLASFFPACK_simd512_INL 29#define __FFLASFFPACK_simd512_INL 30 31struct Simd512fp_base { 32 33 /* Name of the Simd struct */ 34 static inline const std::string type_string () { return "Simd512"; } 35 36 37}; 38 39struct Simd512i_base { 40 41 /* 42 * alias to 512 bit simd register 43 */ 44 using vect_t = __m512i; 45 46 /* Name of the Simd struct */ 47 static inline const std::string type_string () { return "Simd512"; } 48 49 /* 50 * Return vector of type vect_t with all elements set to zero 51 * Return [0, ...,0] 52 */ 53 static INLINE CONST vect_t zero() { return _mm512_setzero_si512(); } 54 55 /* 56 * Compute the bitwise OR and store the results in vect_t. 57 * Args : [a0, ..., a511] 58 * [b0, ..., b511] 59 * Return : [a0 OR b0, ..., a511 OR b511] 60 */ 61 static INLINE CONST vect_t vor(const vect_t a, const vect_t b) { return _mm512_or_si512(b, a); } 62 63 /* 64 * Compute the bitwise XOR and store the results in vect_t. 65 * Args : [a0, ..., a511] 66 * [b0, ..., b511] 67 * Return : [a0 XOR b0, ..., a511 XOR b511] 68 */ 69 static INLINE CONST vect_t vxor(const vect_t a, const vect_t b) { return _mm512_xor_si512(b, a); } 70 71 /* 72 * Compute the bitwise AND and store the results in vect_t. 73 * Args : [a0, ..., a511] 74 * [b0, ..., b511] 75 * Return : [a0 AND b0, ..., a511 AND b511] 76 */ 77 static INLINE CONST vect_t vand(const vect_t a, const vect_t b) { return _mm512_and_si512(b, a); } 78 79 /* 80 * Compute the bitwise NOT AND and store the results in vect_t. 81 * Args : [a0, ..., a511] 82 * [b0, ..., b511] 83 * Return : [(NOT a0) AND b0, ..., (NOT a511) AND b511] 84 */ 85 static INLINE CONST vect_t vandnot(const vect_t a, const vect_t b) { return _mm512_andnot_si512(a, b); } 86 87 88}; 89 90template <bool ArithType, bool Int, bool Signed, int Size> struct Simd512_impl; 91 92template <class T> 93using Simd512 = 94Simd512_impl<std::is_arithmetic<T>::value, std::is_integral<T>::value, std::is_signed<T>::value, sizeof(T)>; 95 96#include "simd512_float.inl" 97#include "simd512_double.inl" 98#include "simd512_int64.inl" 99 100#endif // __FFLASFFPACK_simd512_INL 101/* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 102// vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s 103