This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[new testcase] i386-simd-11.c


A new testcase for SSE:

------------------------------------------------------------------------ --------
/* { dg-do compile { target i?86-*-* } } */
/* { 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;
}
------------------------------------------------------------------------ --------


This exercises some vector constant folding. Passes on mainline (but failed on one of Apples branches :-). Preapproved for mainline by Geoff Keating.

Unless somebody objects (or suggests a significant change) I'll commit this as gcc.dg/i386-simd-11.c in the next day or two.

stuart hastings
Apple Computer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]