blob: 23d25c0b079757bd44bfdfcf856bfe5c07e2f268 (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fdump-tree-vect-details" } */
#ifndef SIZE
#define SIZE 1024
#endif
#ifndef ALIGN
#define ALIGN 32
#endif
#ifndef TYPE
#define TYPE long long
#endif
#ifndef SIGN_TYPE
#define SIGN_TYPE signed TYPE
#endif
#ifndef UNS_TYPE
#define UNS_TYPE unsigned TYPE
#endif
#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
SIGN_TYPE sa[SIZE] ALIGN_ATTR;
SIGN_TYPE sb[SIZE] ALIGN_ATTR;
SIGN_TYPE sc[SIZE] ALIGN_ATTR;
UNS_TYPE ua[SIZE] ALIGN_ATTR;
UNS_TYPE ub[SIZE] ALIGN_ATTR;
UNS_TYPE uc[SIZE] ALIGN_ATTR;
void
sign_lt (SIGN_TYPE val1, SIGN_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
sa[i] = (sb[i] < sc[i]) ? val1 : val2;
}
void
sign_lte (SIGN_TYPE val1, SIGN_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
sa[i] = (sb[i] <= sc[i]) ? val1 : val2;
}
void
sign_gt (SIGN_TYPE val1, SIGN_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
sa[i] = (sb[i] > sc[i]) ? val1 : val2;
}
void
sign_gte (SIGN_TYPE val1, SIGN_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
sa[i] = (sb[i] >= sc[i]) ? val1 : val2;
}
void
uns_lt (UNS_TYPE val1, UNS_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
ua[i] = (ub[i] < uc[i]) ? val1 : val2;
}
void
uns_lte (UNS_TYPE val1, UNS_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
ua[i] = (ub[i] <= uc[i]) ? val1 : val2;
}
void
uns_gt (UNS_TYPE val1, UNS_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
ua[i] = (ub[i] > uc[i]) ? val1 : val2;
}
void
uns_gte (UNS_TYPE val1, UNS_TYPE val2)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
ua[i] = (ub[i] >= uc[i]) ? val1 : val2;
}
/* { dg-final { scan-assembler-times {\mvcmpgtsd\M} 4 } } */
/* { dg-final { scan-assembler-times {\mvcmpgtud\M} 4 } } */
/* { dg-final { scan-assembler-not {\mvcmpequd\M} } } */
/* { dg-final { scan-tree-dump-times "vect_model_simple_cost" 8 "vect" } } */
|