1 2 /* Copyright (c) 2013 Julien Pommier ( pommier@modartt.com ) 3 4 Redistribution and use of the Software in source and binary forms, 5 with or without modification, is permitted provided that the 6 following conditions are met: 7 8 - Neither the names of NCAR's Computational and Information Systems 9 Laboratory, the University Corporation for Atmospheric Research, 10 nor the names of its sponsors or contributors may be used to 11 endorse or promote products derived from this Software without 12 specific prior written permission. 13 14 - Redistributions of source code must retain the above copyright 15 notices, this list of conditions, and the disclaimer below. 16 17 - Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions, and the disclaimer below in the 19 documentation and/or other materials provided with the 20 distribution. 21 22 THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT 26 HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL, 27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE 30 SOFTWARE. 31 */ 32 33 #ifndef PF_DBL_H 34 #define PF_DBL_H 35 36 #include <assert.h> 37 #include <string.h> 38 #include <stdint.h> 39 40 41 /* 42 * SIMD reference material: 43 * 44 * general SIMD introduction: 45 * https://www.linuxjournal.com/content/introduction-gcc-compiler-intrinsics-vector-processing 46 * 47 * SSE 1: 48 * https://software.intel.com/sites/landingpage/IntrinsicsGuide/ 49 * 50 * ARM NEON: 51 * https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics 52 * 53 * Altivec: 54 * https://www.nxp.com/docs/en/reference-manual/ALTIVECPIM.pdf 55 * https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html 56 * better one? 57 * 58 */ 59 60 typedef double vsfscalar; 61 62 #include "pf_avx_double.h" 63 #include "pf_sse2_double.h" 64 #include "pf_neon_double.h" 65 66 #ifndef SIMD_SZ 67 # if !defined(PFFFT_SIMD_DISABLE) 68 # pragma message( "building double with simd disabled !" ) 69 # define PFFFT_SIMD_DISABLE /* fallback to scalar code */ 70 # endif 71 #endif 72 73 #include "pf_scalar_double.h" 74 75 /* shortcuts for complex multiplcations */ 76 #define VCPLXMUL(ar,ai,br,bi) { v4sf tmp; tmp=VMUL(ar,bi); ar=VMUL(ar,br); ar=VSUB(ar,VMUL(ai,bi)); ai=VMUL(ai,br); ai=VADD(ai,tmp); } 77 #define VCPLXMULCONJ(ar,ai,br,bi) { v4sf tmp; tmp=VMUL(ar,bi); ar=VMUL(ar,br); ar=VADD(ar,VMUL(ai,bi)); ai=VMUL(ai,br); ai=VSUB(ai,tmp); } 78 #ifndef SVMUL 79 /* multiply a scalar with a vector */ 80 #define SVMUL(f,v) VMUL(LD_PS1(f),v) 81 #endif 82 83 #endif /* PF_DBL_H */ 84 85