Ejemplo n.º 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" } */
}
Ejemplo n.º 2
0
I32 roundInt(F32 val) {
#ifdef USE_SSE4
    __m128 t = _mm_set_ss(val);
    t = _mm_round_ss(t, t, _MM_FROUND_TO_NEAREST_INT);
    I32 i = _mm_cvtss_si32(t);
#elif defined(USE_SSE2)
    __m128 t = _mm_set_ss(val);
	I32 i = (I32)_mm_cvtss_si32(t);
#else
	I32 i = (I32)core_floor(val + 0.5f);
#endif
    return i;
}
Ejemplo n.º 3
0
F32 round(F32 val) {
#ifdef USE_SSE4
    __m128 t = _mm_set_ss(val);
    t = _mm_round_ss(t, t, _MM_FROUND_TO_NEAREST_INT);
    _mm_store_ss(&val, t);
#elif defined(USE_SSE2)
    __m128 t = _mm_set_ss(val);
	U32 i = (U32)_mm_cvtss_si32(t);
	t = _mm_cvtsi32_ss(t, (int32)i);
	_mm_store_ss(&val, t);
#else
	val = (F32)core_floor(val + 0.5f);
#endif
    return val;
}
Ejemplo n.º 4
0
__m128 test_mm_round_ss(__m128 x, __m128 y) {
  // CHECK: define {{.*}} @test_mm_round_ss
  // CHECK: @llvm.x86.sse41.round.ss
  return _mm_round_ss(x, y, 2);
}
Ejemplo n.º 5
0
__m128 test_mm_round_ss(__m128 x, __m128 y) {
  // CHECK-LABEL: test_mm_round_ss
  // CHECK: call <4 x float> @llvm.x86.sse41.round.ss
  // CHECK-ASM: roundss $2, %xmm{{.*}}, %xmm{{.*}}
  return _mm_round_ss(x, y, 2);
}
Ejemplo n.º 6
0
__m128 test_mm_round_ss(__m128 x, __m128 y) {
  // CHECK-LABEL: test_mm_round_ss
  // CHECK: call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 4)
  return _mm_round_ss(x, y, 4);
}