blob: f230936c7847f564f89720aea13f15a002d39aa9 (
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
|
/* { 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 -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */
#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
typedef vector SIGN_TYPE v_sign;
typedef vector UNS_TYPE v_uns;
v_sign sign_add (v_sign a, v_sign b)
{
return a + b;
}
v_sign sign_sub (v_sign a, v_sign b)
{
return a - b;
}
v_sign sign_shift_left (v_sign a, v_sign b)
{
return a << b;
}
v_sign sign_shift_right (v_sign a, v_sign b)
{
return a >> b;
}
v_uns uns_add (v_uns a, v_uns b)
{
return a + b;
}
v_uns uns_sub (v_uns a, v_uns b)
{
return a - b;
}
v_uns uns_shift_left (v_uns a, v_uns b)
{
return a << b;
}
v_uns uns_shift_right (v_uns a, v_uns b)
{
return a >> b;
}
/* { dg-final { scan-assembler-times "vaddudm" 2 } } */
/* { dg-final { scan-assembler-times "vsubudm" 2 } } */
/* { dg-final { scan-assembler-times "vsld" 2 } } */
/* { dg-final { scan-assembler-times "vsrad" 1 } } */
/* { dg-final { scan-assembler-times "vsrd" 1 } } */
|