Previous Le fichier header |
Parent Appel de fonction vectorisé |
Outline | Next Main générique |
Écrivons le fichier function_vectorize.cpp :
1 2 |
#include <cmath> #include "phoenix_intrinsics.h" |
1 |
#include "function_vectorize.h"
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
///Do the function call /** @param[out] ptabResult : table of results of function(tabX) * @param ptabX : input table * @param nbElement : number of elements in the tables */ void function_vectorize(float* __restrict__ ptabResult, const float* __restrict__ ptabX, size_t nbElement){ float* tabResult = (float*)__builtin_assume_aligned(ptabResult, PLIB_VECTOR_SIZE_BYTE_FLOAT); const float* tabX = (const float*)__builtin_assume_aligned(ptabX, PLIB_VECTOR_SIZE_BYTE_FLOAT); for(size_t i(0lu); i < nbElement; ++i){ tabResult[i] = std::COMPUTE_FUNCTION_DEF(tabX[i]); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ #include <cmath> #include "phoenix_intrinsics.h" #include "function_vectorize.h" ///Do the function call /** @param[out] ptabResult : table of results of function(tabX) * @param ptabX : input table * @param nbElement : number of elements in the tables */ void function_vectorize(float* __restrict__ ptabResult, const float* __restrict__ ptabX, size_t nbElement){ float* tabResult = (float*)__builtin_assume_aligned(ptabResult, PLIB_VECTOR_SIZE_BYTE_FLOAT); const float* tabX = (const float*)__builtin_assume_aligned(ptabX, PLIB_VECTOR_SIZE_BYTE_FLOAT); for(size_t i(0lu); i < nbElement; ++i){ tabResult[i] = std::COMPUTE_FUNCTION_DEF(tabX[i]); } } |
Previous Le fichier header |
Parent Appel de fonction vectorisé |
Outline | Next Main générique |