Example #1
0
void
test4bit (void)
{
  d1 = _mm_round_pd (d2, k4);		  /* { dg-error "the last argument must be a 4-bit immediate" } */
  d1 = _mm_round_sd (d2, d3, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
  a1 = _mm_round_ps (a2, k4);		  /* { dg-error "the last argument must be a 4-bit immediate" } */
  a1 = _mm_round_ss (a2, a2, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
  a1 = _mm_blend_ps (a2, a3, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
  e1 = _mm256_blend_pd (e2, e3, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
  e1 = _mm256_round_pd (e2, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
  b1 = _mm256_round_ps (b2, k4);	  /* { dg-error "the last argument must be a 4-bit immediate" } */
}
Example #2
0
I32 roundInt(F64 val) {
#ifdef USE_SSE4
    __m128d t = _mm_set_sd(val);
    t = _mm_round_sd(t, t, _MM_FROUND_TO_NEAREST_INT);
    I32 i = _mm_cvtsd_si32(t);
#elif defined(USE_SSE2)
    __m128d t = _mm_set_sd(val);
	I32 i = (I32)_mm_cvtsd_si32(t);
#else
	I32 i = (I32)core_floor(val + 0.5);
#endif
    return i;
}
Example #3
0
F64 round(F64 val) {
#ifdef USE_SSE4
    __m128d t = _mm_set_sd(val);
    t = _mm_round_sd(t, t, _MM_FROUND_TO_NEAREST_INT);
    _mm_store_sd(&val, t);
#elif defined(USE_SSE2)
    __m128d t = _mm_set_sd(val);
	U32 i = (U32)_mm_cvtsd_si32(t);
	t = _mm_cvtsi32_sd(t, (int32)i);
	_mm_store_sd(&val, t);
#else
	val = core_floor(val + 0.5);
#endif
    return val;
}
static void
TEST (void)
{
  union128d u, s;
  double e[2] = {0.0};
  int i;

  s.x = _mm_set_pd (1.1234, -2.3478);
  u.x = _mm_round_pd (s.x, iRoundMode);

  for (i = 0; i < 2; i++)
    {
      __m128d tmp = _mm_load_sd (&s.a[i]);
      tmp = _mm_round_sd (tmp, tmp, iRoundMode);
      _mm_store_sd (&e[i], tmp);
    }
  
  if (check_union128d (u, e))
    abort ();
} 
Example #5
0
__m128d test_mm_round_sd(__m128d x, __m128d y) {
  // CHECK: define {{.*}} @test_mm_round_sd
  // CHECK: @llvm.x86.sse41.round.sd
  return _mm_round_sd(x, y, 2);
}
Example #6
0
__m128d test_mm_round_sd(__m128d x, __m128d y) {
  // CHECK-LABEL: test_mm_round_sd
  // CHECK: call <2 x double> @llvm.x86.sse41.round.sd
  // CHECK-ASM: roundsd $2, %xmm{{.*}}, %xmm{{.*}}
  return _mm_round_sd(x, y, 2);
}
Example #7
0
__m128d test_mm_round_sd(__m128d x, __m128d y) {
  // CHECK-LABEL: test_mm_round_sd
  // CHECK: call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 4)
  return _mm_round_sd(x, y, 4);
}