Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/pr97019.c

raw
1 /* This issue can only exist on little-endian P8 targets, since
2 the built-in functions vec_ld/vec_st can use lxvd2x/stxvd2x
3 (P8 big-endian) or lxv/stxv (P9 and later) for some cases,
4 those rldicr instructions fed to them are necessary. */
5 /* { dg-do compile } */
6 /* { dg-options "-O2 -mdejagnu-cpu=power8 -mvsx" } */
7 /* { dg-require-effective-target powerpc_vsx } */
8 /* { dg-require-effective-target le } */
9
10 /* Test there are no useless instructions "rldicr x,y,0,59"
11 to align the addresses for lvx/stvx. */
12
13 extern int a, b, c;
14 extern vector unsigned long long ev5, ev6, ev7, ev8;
15 extern int dummy (vector unsigned long long);
16
17 int test_vec_ld(unsigned char *pe) {
18
19 vector unsigned long long v1, v2, v3, v4, v9;
20 vector unsigned long long v5 = ev5;
21 vector unsigned long long v6 = ev6;
22 vector unsigned long long v7 = ev7;
23 vector unsigned long long v8 = ev8;
24
25 unsigned char *e = pe;
26
27 do {
28 if (a) {
29 v1 = __builtin_vec_ld(16, (unsigned long long *)e);
30 v2 = __builtin_vec_ld(32, (unsigned long long *)e);
31 v3 = __builtin_vec_ld(48, (unsigned long long *)e);
32 e = e + 8;
33 for (int i = 0; i < a; i++) {
34 v4 = v5;
35 v5 = __builtin_crypto_vpmsumd(v1, v6);
36 v6 = __builtin_crypto_vpmsumd(v2, v7);
37 v7 = __builtin_crypto_vpmsumd(v3, v8);
38 e = e + 8;
39 }
40 }
41 v5 = __builtin_vec_ld(16, (unsigned long long *)e);
42 v6 = __builtin_vec_ld(32, (unsigned long long *)e);
43 v7 = __builtin_vec_ld(48, (unsigned long long *)e);
44 if (c)
45 b = 1;
46 } while (b);
47
48 return dummy(v4);
49 }
50
51 int test_vec_st(unsigned char *pe) {
52
53 vector unsigned long long v1, v2, v3, v4;
54 vector unsigned long long v5 = ev5;
55 vector unsigned long long v6 = ev6;
56 vector unsigned long long v7 = ev7;
57 vector unsigned long long v8 = ev8;
58
59 unsigned char *e = pe;
60
61 do {
62 if (a) {
63 __builtin_vec_st(v1, 16, (unsigned long long *)e);
64 __builtin_vec_st(v2, 32, (unsigned long long *)e);
65 __builtin_vec_st(v3, 48, (unsigned long long *)e);
66 e = e + 8;
67 for (int i = 0; i < a; i++) {
68 v4 = v5;
69 v5 = __builtin_crypto_vpmsumd(v1, v6);
70 v6 = __builtin_crypto_vpmsumd(v2, v7);
71 v7 = __builtin_crypto_vpmsumd(v3, v8);
72 e = e + 8;
73 }
74 }
75 __builtin_vec_st(v5, 16, (unsigned long long *)e);
76 __builtin_vec_st(v6, 32, (unsigned long long *)e);
77 __builtin_vec_st(v7, 48, (unsigned long long *)e);
78 if (c)
79 b = 1;
80 } while (b);
81
82 return dummy(v4);
83 }
84
85 /* { dg-final { scan-assembler-not {(?n)rldicr.*,0,59} } } */