summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/sse2-check.h
blob: beb1b7d24f4cbb6ce07bee56d010c470b4501566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdlib.h>

/* Define this to enable the combination of VSX vector double and
   SSE2 data types.  */
#define __VSX_SSE2__ 1

#include "m128-check.h"

/* define DEBUG replace abort with printf on error.  */
//#define DEBUG 1

#if 1

#define TEST sse2_test

static void sse2_test (void);

static void
__attribute__ ((noinline))
do_test (void)
{
  sse2_test ();
}

int
main ()
  {
#ifdef __BUILTIN_CPU_SUPPORTS__
    /* Most SSE2 (vector double) intrinsic operations require VSX
       instructions, but some operations may need only VMX
       instructions.  This also true for SSE2 scalar doubles as they
       imply that "other half" of the vector remains unchanged or set
       to zeros.  The VSX scalar operations leave ther "other half"
       undefined, and require additional merge operations.
       Some conversions (to/from integer) need the  direct register
       transfer instructions from POWER8 for best performance.
       So we test for arch_2_07.  */
    if ( __builtin_cpu_supports ("arch_2_07") )
      {
	do_test ();
#ifdef DEBUG
	printf ("PASSED\n");
#endif
      }
#ifdef DEBUG
    else
    printf ("SKIPPED\n");
#endif
#endif /* __BUILTIN_CPU_SUPPORTS__ */
    return 0;
  }
#endif