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 { target { powerpc_p8vector_ok && le } } } */
6 /* { dg-options "-O2 -mdejagnu-cpu=power8" } */
7
8 /* Test there are no useless instructions "rldicr x,y,0,59"
9 to align the addresses for lvx/stvx. */
10
11 extern int a, b, c;
12 extern vector unsigned long long ev5, ev6, ev7, ev8;
13 extern int dummy (vector unsigned long long);
14
15 int test_vec_ld(unsigned char *pe) {
16
17 vector unsigned long long v1, v2, v3, v4, v9;
18 vector unsigned long long v5 = ev5;
19 vector unsigned long long v6 = ev6;
20 vector unsigned long long v7 = ev7;
21 vector unsigned long long v8 = ev8;
22
23 unsigned char *e = pe;
24
25 do {
26 if (a) {
27 v1 = __builtin_vec_ld(16, (unsigned long long *)e);
28 v2 = __builtin_vec_ld(32, (unsigned long long *)e);
29 v3 = __builtin_vec_ld(48, (unsigned long long *)e);
30 e = e + 8;
31 for (int i = 0; i < a; i++) {
32 v4 = v5;
33 v5 = __builtin_crypto_vpmsumd(v1, v6);
34 v6 = __builtin_crypto_vpmsumd(v2, v7);
35 v7 = __builtin_crypto_vpmsumd(v3, v8);
36 e = e + 8;
37 }
38 }
39 v5 = __builtin_vec_ld(16, (unsigned long long *)e);
40 v6 = __builtin_vec_ld(32, (unsigned long long *)e);
41 v7 = __builtin_vec_ld(48, (unsigned long long *)e);
42 if (c)
43 b = 1;
44 } while (b);
45
46 return dummy(v4);
47 }
48
49 int test_vec_st(unsigned char *pe) {
50
51 vector unsigned long long v1, v2, v3, v4;
52 vector unsigned long long v5 = ev5;
53 vector unsigned long long v6 = ev6;
54 vector unsigned long long v7 = ev7;
55 vector unsigned long long v8 = ev8;
56
57 unsigned char *e = pe;
58
59 do {
60 if (a) {
61 __builtin_vec_st(v1, 16, (unsigned long long *)e);
62 __builtin_vec_st(v2, 32, (unsigned long long *)e);
63 __builtin_vec_st(v3, 48, (unsigned long long *)e);
64 e = e + 8;
65 for (int i = 0; i < a; i++) {
66 v4 = v5;
67 v5 = __builtin_crypto_vpmsumd(v1, v6);
68 v6 = __builtin_crypto_vpmsumd(v2, v7);
69 v7 = __builtin_crypto_vpmsumd(v3, v8);
70 e = e + 8;
71 }
72 }
73 __builtin_vec_st(v5, 16, (unsigned long long *)e);
74 __builtin_vec_st(v6, 32, (unsigned long long *)e);
75 __builtin_vec_st(v7, 48, (unsigned long long *)e);
76 if (c)
77 b = 1;
78 } while (b);
79
80 return dummy(v4);
81 }
82
83 /* { dg-final { scan-assembler-not {(?n)rldicr.*,0,59} } } */