Sponsored Content
Full Discussion: Vectorization
Special Forums UNIX and Linux Applications High Performance Computing Vectorization Post 302895149 by a3mlord on Friday 28th of March 2014 05:03:17 PM
Old 03-28-2014
Signal Vectorization

Hi,

I have the following vectorized code:
Code:
long valor = 0, i=0;

 __m128i vsum, vecPi, vecCi, vecQCi;

 vsum = _mm_set1_epi32(0);

 int32_t * const pA = A->data;
 int32_t * const pB = B->data;

 int sumDot[1];

 for( ; i<SIZE-3 ;i+=4){

 vecPi = _mm_loadu_si128((__m128i *)&(pA)[i] );
 vecCi = _mm_loadu_si128((__m128i *)&(pB)[i] );
 vecQCi = _mm_mullo_epi32(vecPi,vecCi);
 vsum = _mm_add_epi32(vsum,vecQCi);

 } 
 vsum = _mm_hadd_epi32(vsum, vsum);
 vsum = _mm_hadd_epi32(vsum, vsum);
 _mm_storeu_si128((__m128i *)&(sumDot), vsum);

 for( ; i<SIZE; i++)
 valor += A->data[i] * B->data[i];   valor += sumDot[0];

However, as I get overflows, I need to handle those cases. Could you please help me with that?

Thanks

Last edited by bartus11; 03-28-2014 at 06:06 PM.. Reason: Please use [code][/code] tags.
 
types32.h(3HEAD)                                                      Headers                                                     types32.h(3HEAD)

NAME
types32.h, types32 - fixed-width data types SYNOPSIS
#include <sys/types32.h> DESCRIPTION
The following fixed-width data types defined in <sys/types32.h> correspond to the sign and sizes of types in the 32-bit environment that can be used for compatibility and interoperability purposes in either the 32-bit or 64-bit environment. typedef int32_t blkcnt32_t typedef uint32_t caddr32_t typedef int32_t clock32_t typedef int32_t daddr32_t typedef uint32_t dev32_t typedef uint32_t fsblkcnt32_t typedef uint32_t fsfilcnt32_t typedef int32_t gid32_t typedef int32_t id32_t typedef uint32_t ino32_t typedef int32_t key32_t typedef uint32_t major32_t typedef uint32_t minor32_t typedef uint32_t mode32_t typedef uint32_t nlink32_t typedef int32_t pid32_t typedef uint32_t rlim32_t typedef uint32_t size32_t typedef int32_t ssize32_t typedef time32_t int32_t typedef uid32_t int32_t SunOS 5.10 30 Oct 1997 types32.h(3HEAD)
All times are GMT -4. The time now is 02:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy