1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
4 /* { dg-require-effective-target power10_ok } */
5 /* { dg-require-effective-target int128 } */
7 /* Check that the expected 128-bit instructions are generated if the processor
8 supports the 128-bit integer instructions. */
9 /* { dg-final { scan-assembler-times {\mvexpandbm\M} 1 } } */
10 /* { dg-final { scan-assembler-times {\mvexpandhm\M} 1 } } */
11 /* { dg-final { scan-assembler-times {\mvexpandwm\M} 1 } } */
12 /* { dg-final { scan-assembler-times {\mvexpanddm\M} 1 } } */
13 /* { dg-final { scan-assembler-times {\mvexpandqm\M} 1 } } */
28 unsigned long long arg1
;
30 vector
unsigned char vbc_result_bi
, vbc_expected_result_bi
;
31 vector
unsigned short vbc_result_hi
, vbc_expected_result_hi
;
32 vector
unsigned int vbc_result_wi
, vbc_expected_result_wi
;
33 vector
unsigned long long vbc_result_di
, vbc_expected_result_di
;
34 vector __uint128_t vbc_result_qi
, vbc_expected_result_qi
;
36 unsigned int result_wi
, expected_result_wi
;
37 unsigned long long result
, expected_result
;
38 const unsigned char mp
=1;
39 vector
unsigned char vbc_bi_src
;
40 vector
unsigned short vbc_hi_src
;
41 vector
unsigned int vbc_wi_src
;
42 vector
unsigned long long vbc_di_src
;
43 vector __uint128_t vbc_qi_src
;
60 vbc_bi_src
[13] = 0xFF;
61 vbc_bi_src
[14] = 0xFF;
62 vbc_bi_src
[15] = 0xFF;
64 vbc_expected_result_bi
[0] = 0xFF;
65 vbc_expected_result_bi
[1] = 0xFF;
66 vbc_expected_result_bi
[2] = 0x0;
67 vbc_expected_result_bi
[3] = 0x0;
68 vbc_expected_result_bi
[4] = 0x0;
69 vbc_expected_result_bi
[5] = 0x0;
70 vbc_expected_result_bi
[6] = 0xFF;
71 vbc_expected_result_bi
[7] = 0xFF;
72 vbc_expected_result_bi
[8] = 0x0;
73 vbc_expected_result_bi
[9] = 0x0;
74 vbc_expected_result_bi
[10] = 0x0;
75 vbc_expected_result_bi
[11] = 0x0;
76 vbc_expected_result_bi
[12] = 0x0;
77 vbc_expected_result_bi
[13] = 0xFF;
78 vbc_expected_result_bi
[14] = 0xFF;
79 vbc_expected_result_bi
[15] = 0xFF;
81 vbc_result_bi
= vec_expandm (vbc_bi_src
);
83 for (i
= 0; i
<num_elements
; i
++) {
84 if (vbc_result_bi
[i
] != vbc_expected_result_bi
[i
]) {
86 printf("ERROR: char vec_expandm(arg) ");
87 printf("element %d, 0x%x does not match expected value = 0x%x\n",
88 i
, vbc_result_bi
[i
], vbc_expected_result_bi
[i
]);
98 vbc_hi_src
[1] = 0xFFFF;
100 vbc_hi_src
[3] = 0xFFFF;
103 vbc_hi_src
[6] = 0xFFFF;
104 vbc_hi_src
[7] = 0xFFFF;
106 vbc_expected_result_hi
[0] = 0x0;
107 vbc_expected_result_hi
[1] = 0xFFFF;
108 vbc_expected_result_hi
[2] = 0x0;
109 vbc_expected_result_hi
[3] = 0xFFFF;
110 vbc_expected_result_hi
[4] = 0x0;
111 vbc_expected_result_hi
[5] = 0x0;
112 vbc_expected_result_hi
[6] = 0xFFFF;
113 vbc_expected_result_hi
[7] = 0xFFFF;
115 vbc_result_hi
= vec_expandm (vbc_hi_src
);
117 for (i
= 0; i
<num_elements
; i
++) {
118 if (vbc_result_hi
[i
] != vbc_expected_result_hi
[i
]) {
120 printf("ERROR: short vec_expandm(arg) ");
121 printf("element %d, 0x%x does not match expected value = 0x%x\n",
122 i
, vbc_result_hi
[i
], vbc_expected_result_hi
[i
]);
132 vbc_wi_src
[1] = 0xFFFFFFFF;
134 vbc_wi_src
[3] = 0xFFFFFFFF;
136 vbc_expected_result_wi
[0] = 0x0;
137 vbc_expected_result_wi
[1] = 0xFFFFFFFF;
138 vbc_expected_result_wi
[2] = 0x0;
139 vbc_expected_result_wi
[3] = 0xFFFFFFFF;
141 vbc_result_wi
= vec_expandm (vbc_wi_src
);
143 for (i
= 0; i
<num_elements
; i
++) {
144 if (vbc_result_wi
[i
] != vbc_expected_result_wi
[i
]) {
146 printf("ERROR: int vec_expandm(arg) ");
147 printf("element %d, 0x%x does not match expected value = 0x%x\n",
148 i
, vbc_result_wi
[i
], vbc_expected_result_wi
[i
]);
158 vbc_di_src
[1] = 0xFFFFFFFFFFFFFFFFULL
;
160 vbc_expected_result_di
[0] = 0x0;
161 vbc_expected_result_di
[1] = 0xFFFFFFFFFFFFFFFFULL
;
163 vbc_result_di
= vec_expandm (vbc_di_src
);
165 for (i
= 0; i
<num_elements
; i
++) {
166 if (vbc_result_di
[i
] != vbc_expected_result_di
[i
]) {
168 printf("ERROR: double vec_expandm(arg) ");
169 printf("element %d, 0x%llx does not match expected value = 0x%llx\n",
170 i
, vbc_result_di
[i
], vbc_expected_result_di
[i
]);
181 vbc_expected_result_qi
[0] = 0x0;
183 vbc_result_qi
= vec_expandm (vbc_qi_src
);
185 if (vbc_result_qi
[0] != vbc_expected_result_qi
[0]) {
187 printf("ERROR: quad vec_expandm(arg) ");
188 printf("element %d, 0x%x does not match expected value = 0x%x\n",
189 0, vbc_result_qi
[i
], vbc_expected_result_qi
[i
]);