Ejemplo n.º 1
0
void extern
avx512f_test (void)
{
  x = _mm512_max_ps (x, x);
  x = _mm512_mask_max_ps (x, m, x, x);
  x = _mm512_maskz_max_ps (m, x, x);
  x = _mm512_max_round_ps (x, x, _MM_FROUND_NO_EXC);
  x = _mm512_mask_max_round_ps (x, m, x, x, _MM_FROUND_NO_EXC);
  x = _mm512_maskz_max_round_ps (m, x, x, _MM_FROUND_NO_EXC);
}
Ejemplo n.º 2
0
// exp()
inline mic_m512_t mic_exp_ps(mic_m512_t x) {
	x = _mm512_min_ps(x, _ps_exp_hi);
	x = _mm512_max_ps(x, _ps_exp_lo);

	mic_m512_t temp_2 = _mm512_fmadd_ps(x, _ps_cephes_LOG2EF, _ps_0point5);

	mic_m512_t temp_1 = _mm512_round_ps(temp_2, _MM_FROUND_TO_NEAREST_INT, _MM_EXPADJ_NONE);
	mic_m512_t temp_3 = _mm512_sub_ps(temp_1, temp_2);
	__mmask16 mask = _mm512_cmp_ps_mask(temp_3, _ps_0, _MM_CMPINT_GT);

	temp_2 = _mm512_mask_sub_ps(temp_1, mask, temp_1, _ps_1);
	__m512i emm0 = _mm512_cvtfxpnt_round_adjustps_epi32(temp_2, _MM_FROUND_TO_NEAREST_INT, _MM_EXPADJ_NONE);

	x = _mm512_fnmadd_ps(temp_2, _ps_cephes_exp_C12, x);

	mic_m512_t x2 = _mm512_mul_ps(x, x);
	mic_m512_t x3 = _mm512_mul_ps(x2, x);
	mic_m512_t x4 = _mm512_mul_ps(x2, x2);
 
	temp_1 = _mm512_add_ps(x, _ps_1);
	temp_1 = _mm512_fmadd_ps(x2, _ps_cephes_exp_p5, temp_1);
	temp_1 = _mm512_fmadd_ps(x3, _ps_cephes_exp_p4, temp_1);

	temp_2 = _mm512_mul_ps(x3, _ps_cephes_exp_p0);
	temp_3 = _mm512_mul_ps(x2, _ps_cephes_exp_p1);

	mic_m512_t temp_4 = _mm512_mul_ps(x, _ps_cephes_exp_p2);

	emm0 = _mm512_add_epi32(emm0, _pi32_0x7f);

	temp_2 = _mm512_add_ps(temp_2, temp_3);
	temp_3 = _mm512_add_ps(temp_3, temp_4);
	temp_2 = _mm512_add_ps(temp_2, temp_3);

	emm0 = _mm512_slli_epi32(emm0, 23);
	mic_m512_t pow2n = _mm512_castsi512_ps(emm0);

	temp_2 = _mm512_mul_ps(temp_2, x4);

	mic_m512_t y = _mm512_add_ps(temp_1, temp_2);

	y = _mm512_mul_ps(y, pow2n);
	return y;
} // newexp_ps()
Ejemplo n.º 3
0
 static batch_type max(const batch_type& lhs, const batch_type& rhs)
 {
     return _mm512_max_ps(lhs, rhs);
 }