aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c
blob: 0102510dadb679aa4aeb8cb83c1ebdd6d6b61913 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */

#ifndef SIZE
#define SIZE 1024
#endif

#ifndef ALIGN
#define ALIGN 32
#endif

#ifndef ATTR_ALIGN
#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
#endif

#ifndef TYPE
#define TYPE unsigned int
#endif

TYPE in1  [SIZE] ATTR_ALIGN;
TYPE in2  [SIZE] ATTR_ALIGN;
TYPE eqv  [SIZE] ATTR_ALIGN;
TYPE nand1[SIZE] ATTR_ALIGN;
TYPE nand2[SIZE] ATTR_ALIGN;
TYPE orc1 [SIZE] ATTR_ALIGN;
TYPE orc2 [SIZE] ATTR_ALIGN;

void
do_eqv (void)
{
  unsigned long i;

  for (i = 0; i < SIZE; i++)
    {
      eqv[i] = ~(in1[i] ^ in2[i]);
    }
}

void
do_nand1 (void)
{
  unsigned long i;

  for (i = 0; i < SIZE; i++)
    {
      nand1[i] = ~(in1[i] & in2[i]);
    }
}

void
do_nand2 (void)
{
  unsigned long i;

  for (i = 0; i < SIZE; i++)
    {
      nand2[i] = (~in1[i]) | (~in2[i]);
    }
}

void
do_orc1 (void)
{
  unsigned long i;

  for (i = 0; i < SIZE; i++)
    {
      orc1[i] = (~in1[i]) | in2[i];
    }
}

void
do_orc2 (void)
{
  unsigned long i;

  for (i = 0; i < SIZE; i++)
    {
      orc1[i] = in1[i] | (~in2[i]);
    }
}

/* { dg-final { scan-assembler-times "xxleqv"  1 } } */
/* { dg-final { scan-assembler-times "xxlnand" 2 } } */
/* { dg-final { scan-assembler-times "xxlorc"  2 } } */