annotate src/fftw-3.3.8/simd-support/simd-common.h @ 168:ceec0dd9ec9c

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 07 Feb 2020 11:51:13 +0000
parents bd3cc4d1df30
children
rev   line source
cannam@167 1 /*
cannam@167 2 * Copyright (c) 2003, 2007-14 Matteo Frigo
cannam@167 3 * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
cannam@167 4 *
cannam@167 5 * This program is free software; you can redistribute it and/or modify
cannam@167 6 * it under the terms of the GNU General Public License as published by
cannam@167 7 * the Free Software Foundation; either version 2 of the License, or
cannam@167 8 * (at your option) any later version.
cannam@167 9 *
cannam@167 10 * This program is distributed in the hope that it will be useful,
cannam@167 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@167 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@167 13 * GNU General Public License for more details.
cannam@167 14 *
cannam@167 15 * You should have received a copy of the GNU General Public License
cannam@167 16 * along with this program; if not, write to the Free Software
cannam@167 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
cannam@167 18 *
cannam@167 19 */
cannam@167 20
cannam@167 21 /* detection of alignment. This is complicated because a machine may
cannam@167 22 support multiple SIMD extensions (e.g. SSE2 and AVX) but only one
cannam@167 23 set of alignment contraints. So this alignment stuff cannot be
cannam@167 24 defined in the SIMD header files. Rather than defining a separate
cannam@167 25 set of "machine" header files, we just do this ugly ifdef here. */
cannam@167 26 #if defined(HAVE_AVX512)
cannam@167 27 # if defined(FFTW_SINGLE)
cannam@167 28 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */
cannam@167 29 # define ALIGNMENTA 64 /* Alignment for the LDA/STA macros */
cannam@167 30 # else
cannam@167 31 # define ALIGNMENT 16 /* Alignment for the LD/ST macros */
cannam@167 32 # define ALIGNMENTA 64 /* Alignment for the LDA/STA macros */
cannam@167 33 # endif
cannam@167 34 #elif defined(HAVE_SSE2) || defined(HAVE_AVX) || defined(HAVE_AVX2) || (HAVE_AVX_128_FMA)
cannam@167 35 # if defined(FFTW_SINGLE)
cannam@167 36 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */
cannam@167 37 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */
cannam@167 38 # else
cannam@167 39 # define ALIGNMENT 16 /* Alignment for the LD/ST macros */
cannam@167 40 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */
cannam@167 41 # endif
cannam@167 42 #elif defined(HAVE_ALTIVEC)
cannam@167 43 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */
cannam@167 44 # define ALIGNMENTA 16 /* Alignment for the LDA/STA macros */
cannam@167 45 #elif defined(HAVE_NEON) || defined(HAVE_VSX)
cannam@167 46 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */
cannam@167 47 # define ALIGNMENTA 8 /* Alignment for the LDA/STA macros */
cannam@167 48 #elif defined(HAVE_KCVI)
cannam@167 49 # if defined(FFTW_SINGLE)
cannam@167 50 # define ALIGNMENT 8 /* Alignment for the LD/ST macros */
cannam@167 51 # else
cannam@167 52 # define ALIGNMENT 16 /* Alignment for the LD/ST macros */
cannam@167 53 # endif
cannam@167 54 # define ALIGNMENTA 64 /* Alignment for the LDA/STA macros */
cannam@167 55 #elif defined(HAVE_GENERIC_SIMD256)
cannam@167 56 # if defined(FFTW_SINGLE)
cannam@167 57 # define ALIGNMENT 8
cannam@167 58 # define ALIGNMENTA 32
cannam@167 59 # else
cannam@167 60 # define ALIGNMENT 16
cannam@167 61 # define ALIGNMENTA 32
cannam@167 62 # endif
cannam@167 63 #elif defined(HAVE_GENERIC_SIMD128)
cannam@167 64 # if defined(FFTW_SINGLE)
cannam@167 65 # define ALIGNMENT 8
cannam@167 66 # define ALIGNMENTA 16
cannam@167 67 # else
cannam@167 68 # define ALIGNMENT 16
cannam@167 69 # define ALIGNMENTA 16
cannam@167 70 # endif
cannam@167 71 #endif
cannam@167 72
cannam@167 73 #if HAVE_SIMD
cannam@167 74 # ifndef ALIGNMENT
cannam@167 75 # error "ALIGNMENT not defined"
cannam@167 76 # endif
cannam@167 77 # ifndef ALIGNMENTA
cannam@167 78 # error "ALIGNMENTA not defined"
cannam@167 79 # endif
cannam@167 80 #endif
cannam@167 81
cannam@167 82 /* rename for precision and for SIMD extensions */
cannam@167 83 #define XSIMD0(name, suffix) CONCAT(name, suffix)
cannam@167 84 #define XSIMD(name) XSIMD0(X(name), SIMD_SUFFIX)
cannam@167 85 #define XSIMD_STRING(x) x STRINGIZE(SIMD_SUFFIX)
cannam@167 86
cannam@167 87 /* TAINT_BIT is set if pointers are not guaranteed to be multiples of
cannam@167 88 ALIGNMENT */
cannam@167 89 #define TAINT_BIT 1
cannam@167 90
cannam@167 91 /* TAINT_BITA is set if pointers are not guaranteed to be multiples of
cannam@167 92 ALIGNMENTA */
cannam@167 93 #define TAINT_BITA 2
cannam@167 94
cannam@167 95 #define PTRINT(p) ((uintptr_t)(p))
cannam@167 96
cannam@167 97 #define ALIGNED(p) \
cannam@167 98 (((PTRINT(UNTAINT(p)) % ALIGNMENT) == 0) && !(PTRINT(p) & TAINT_BIT))
cannam@167 99
cannam@167 100 #define ALIGNEDA(p) \
cannam@167 101 (((PTRINT(UNTAINT(p)) % ALIGNMENTA) == 0) && !(PTRINT(p) & TAINT_BITA))
cannam@167 102
cannam@167 103 #define SIMD_STRIDE_OK(x) (!(((x) * sizeof(R)) % ALIGNMENT))
cannam@167 104 #define SIMD_STRIDE_OKA(x) (!(((x) * sizeof(R)) % ALIGNMENTA))
cannam@167 105 #define SIMD_VSTRIDE_OK SIMD_STRIDE_OK
cannam@167 106