hmmer-3.3/easel/esl_avx512.h
/* Function: esl_avx512_hsum_ps()
 * Synopsis: sums the floating-point values in an __m512 vector
 *           returns the result in ret_sum
 * Purpose:  To compute the sum of the 32-bit float elements of a 512-bit vector 
 */
esl_avx512_hsum_ps()
Synopsis: sums the floating-point values in an __m512 vector
returns the result in ret_sum
Purpose:  To compute the sum of the 32-bit float elements of a 512-bit vector
esl_avx512_hsum_ps () Synopsis : sums the floating - point values in an __m512 vector returns the result in ret_sum Purpose : To compute the sum of the 32 - bit float elements of a 512 - bit vector
static inline void
esl_avx512_hsum_ps(__m512 a, float *ret_sum)
{
  __m512 temp1_AVX_512 = _mm512_shuffle_f32x4(a, a, 0x4e);  
  __m512 temp2_AVX_512 = _mm512_add_ps(a, temp1_AVX_512); 
  temp1_AVX_512 = _mm512_shuffle_f32x4(temp2_AVX_512, temp2_AVX_512, 0xb1);  
  temp2_AVX_512 = _mm512_add_ps(temp2_AVX_512, temp1_AVX_512); 
  temp1_AVX_512 = _mm512_shuffle_ps(temp2_AVX_512, temp2_AVX_512, 0x4e);  
  temp2_AVX_512 = _mm512_add_ps(temp2_AVX_512, temp1_AVX_512); 
  temp1_AVX_512 = _mm512_shuffle_ps(temp2_AVX_512, temp2_AVX_512, 0xb1);  
  temp2_AVX_512 = _mm512_add_ps(temp2_AVX_512, temp1_AVX_512); 
  __m256 temp3_AVX = _mm512_extractf32x8_ps(temp2_AVX_512, 0); 
  int *retint_ptr = (int *) ret_sum;  
  *retint_ptr = _mm256_extract_epi32((__m256i) temp3_AVX, 0);
}
static inline void esl_avx512_hsum_ps ( __m512 a , float * ret_sum ) { __m512 temp1_AVX_512 = _mm512_shuffle_f32x4 ( a , a , 0x4e ) ; __m512 temp2_AVX_512 = _mm512_add_ps ( a , temp1_AVX_512 ) ; temp1_AVX_512 = _mm512_shuffle_f32x4 ( temp2_AVX_512 , temp2_AVX_512 , 0xb1 ) ; temp2_AVX_512 = _mm512_add_ps ( temp2_AVX_512 , temp1_AVX_512 ) ; temp1_AVX_512 = _mm512_shuffle_ps ( temp2_AVX_512 , temp2_AVX_512 , 0x4e ) ; temp2_AVX_512 = _mm512_add_ps ( temp2_AVX_512 , temp1_AVX_512 ) ; temp1_AVX_512 = _mm512_shuffle_ps ( temp2_AVX_512 , temp2_AVX_512 , 0xb1 ) ; temp2_AVX_512 = _mm512_add_ps ( temp2_AVX_512 , temp1_AVX_512 ) ; __m256 temp3_AVX = _mm512_extractf32x8_ps ( temp2_AVX_512 , 0 ) ; int * retint_ptr = ( int * ) ret_sum ; * retint_ptr = _mm256_extract_epi32 ( ( __m256i ) temp3_AVX , 0 ) ; }
Function: esl_avx512_hsum_ps()
 Synopsis: sums the floating-point values in an __m512 vector
           returns the result in ret_sum
 Purpose:  To compute the sum of the 32-bit float elements of a 512-bit vector
Function : esl_avx512_hsum_ps () Synopsis : sums the floating - point values in an __m512 vector returns the result in ret_sum Purpose : To compute the sum of the 32 - bit float elements of a 512 - bit vector
//swap high and low halves of a // sum corresponding floats in the high, low halves //swap high and low quarters of each half of temp2 // sum corresponding floats in the high, low quarters //swap high and low eigths of each quarter of a // sum corresponding floats in the high, low eighths //swap high and low sixteenths of each eighth  // each element of temp2_AVX_512 now contains the sum of all the floats in a //Grab the low half of temp2_AVX_512  // because AVX-512 doesn't provide an operation to extract one float from a 512-bit vector // printf("output sum vector is: "); // print_512(temp2_AVX_512); // This is a horrible hack because there isn't an intrinsic to extract a float from // an __m256.  Do this to avoid casting an int back to a float and screwing it up