sse-2.c: New.

2005-03-21  Stuart Hastings  <stuart@apple.com>

	* gcc.target/i386/sse-2.c: New.

From-SVN: r96820
This commit is contained in:
Stuart Hastings 2005-03-21 17:51:02 +00:00 committed by Stuart Hastings
parent 90ee136828
commit 979632a0db
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2005-03-21 Stuart Hastings <stuart@apple.com>
* gcc.target/i386/sse-2.c: New.
2005-03-21 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/builtins-46.c: Also check lrint* and llrint*.

View file

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O3 -msse" } */
#include <xmmintrin.h>
static const __m128 v_sign = {-.0f, -.0f, -.0f, -.0f};
static const __m128 v_half = {0.5f, 0.5f, 0.5f, 0.5f};
static const __m128 v_one = {1.0f, 1.0f, 1.0f, 1.0f};
static inline __m128 insn_ABS (__m128 a)
{
return _mm_andnot_ps (v_sign, a);
}
__m128 voodoo (__m128 a)
{
__m128 x = insn_ABS (a), y = _mm_rsqrt_ps (x);
y = _mm_add_ps (_mm_mul_ps (_mm_sub_ps (_mm_setzero_ps(), _mm_sub_ps (_mm_mul_ps (x, _mm_add_ps (_mm_mul_ps (y, y), _mm_setzero_ps())), v_one)), _mm_add_ps (_mm_mul_ps (y, v_half), _mm_setzero_ps())), y);
return y;
}