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
|
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
/* { dg-options "-mcpu=power8 -O2" } */
/* { dg-final { scan-assembler-times "bcdadd\[.\] " 4 } } */
/* { dg-final { scan-assembler-times "bcdsub\[.\] " 4 } } */
/* { dg-final { scan-assembler-not "bl __builtin" } } */
/* { dg-final { scan-assembler-not "mtvsr" } } */
/* { dg-final { scan-assembler-not "mfvsr" } } */
/* { dg-final { scan-assembler-not "lvx" } } */
/* { dg-final { scan-assembler-not "lxvw4x" } } */
/* { dg-final { scan-assembler-not "lxvd2x" } } */
/* { dg-final { scan-assembler-not "stvx" } } */
/* { dg-final { scan-assembler-not "stxvw4x" } } */
/* { dg-final { scan-assembler-not "stxvd2x" } } */
typedef __int128_t __attribute__((__vector_size__(16))) vector_128_t;
typedef __int128_t scalar_128_t;
typedef unsigned long long scalar_64_t;
/* Test whether the peephole works to allow folding a bcdadd, with a
bcdadd_<test> into a single instruction. */
vector_128_t
do_add_lt (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdadd (a, b, 0);
if (__builtin_bcdadd_lt (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_add_eq (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdadd (a, b, 0);
if (__builtin_bcdadd_eq (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_add_gt (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdadd (a, b, 0);
if (__builtin_bcdadd_gt (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_add_ov (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdadd (a, b, 0);
if (__builtin_bcdadd_ov (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_sub_lt (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdsub (a, b, 0);
if (__builtin_bcdsub_lt (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_sub_eq (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdsub (a, b, 0);
if (__builtin_bcdsub_eq (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_sub_gt (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdsub (a, b, 0);
if (__builtin_bcdsub_gt (a, b, 0))
*p = 1;
return ret;
}
vector_128_t
do_sub_ov (vector_128_t a, vector_128_t b, int *p)
{
vector_128_t ret = __builtin_bcdsub (a, b, 0);
if (__builtin_bcdsub_ov (a, b, 0))
*p = 1;
return ret;
}
|