/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/

#include "phoenix_intrinsics.h"

#include "hadamard_product_intrinsics.h"

///Do the Hadamard product
/**	@param[out] tabResult : table of results of tabX*tabY
 * 	@param tabX : input table
 * 	@param tabY : input table
 * 	@param nbElement : number of elements in the tables
*/
void hadamard_product_intrinsics(float* tabResult, const float* tabX, const float* tabY, size_t nbElement){
	size_t vecSize(PLIB_VECTOR_SIZE_FLOAT);
	size_t nbVec(nbElement/vecSize);
	for(size_t i(0lu); i < nbVec; ++i){
		PRegVecf vecX = plib_load_ps(tabX + i*vecSize);
		PRegVecf vecY = plib_load_ps(tabY + i*vecSize);
		PRegVecf vecRes = plib_mul_ps(vecX, vecY);
		plib_store_ps(tabResult + i*vecSize, vecRes);
	}
}



