rsimd

Make SIMD instruction sets easier to use
git clone git://git.meso-star.fr/rsimd.git
Log | Files | Refs | README | LICENSE

soaXf3.h (1415B)


      1 /* Copyright (C) 2014-2019, 2021, 2023, 2025 Vincent Forest (vaplv@free.fr)
      2  *
      3  * The RSIMD library is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published
      5  * by the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * The RSIMD library is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with the RSIMD library. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef RSIMD_WIDTH__ 
     17   #error "Undefined RSIMD_WIDTH__ macro"
     18 #endif
     19 
     20 #define RSIMD_SOA_DIMENSION__ 3
     21 #include "soaXfY_begin.h"
     22 #include "soaXfY.h"
     23 
     24 static FINLINE RSIMD_vXf_T__*
     25 RSIMD_soaXfY__(cross)
     26   (RSIMD_vXf_T__ dst[3],
     27    const RSIMD_vXf_T__ a[3],
     28    const RSIMD_vXf_T__ b[3])
     29 {
     30   RSIMD_vXf_T__ tmp[3];
     31   ASSERT(dst && a && b);
     32   tmp[0] = RSIMD_vXf__(sub)(RSIMD_vXf__(mul)(a[1], b[2]), RSIMD_vXf__(mul)(a[2], b[1]));
     33   tmp[1] = RSIMD_vXf__(sub)(RSIMD_vXf__(mul)(a[2], b[0]), RSIMD_vXf__(mul)(a[0], b[2]));
     34   tmp[2] = RSIMD_vXf__(sub)(RSIMD_vXf__(mul)(a[0], b[1]), RSIMD_vXf__(mul)(a[1], b[0]));
     35   return RSIMD_soaXfY__(set__)(dst, tmp);
     36 }
     37 
     38 #include "soaXfY_end.h"