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 {\mvextractbm\M} 1 } } */
10 /* { dg-final { scan-assembler-times {\mvextracthm\M} 1 } } */
11 /* { dg-final { scan-assembler-times {\mvextractwm\M} 1 } } */
12 /* { dg-final { scan-assembler-times {\mvextractdm\M} 1 } } */
13 /* { dg-final { scan-assembler-times {\mvextractqm\M} 1 } } */
29 unsigned long long arg1
;
31 vector
unsigned char vbc_result_bi
, vbc_expected_result_bi
;
32 vector
unsigned short vbc_result_hi
, vbc_expected_result_hi
;
33 vector
unsigned int vbc_result_wi
, vbc_expected_result_wi
;
34 vector
unsigned long long vbc_result_di
, vbc_expected_result_di
;
35 vector __uint128_t vbc_result_qi
, vbc_expected_result_qi
;
37 unsigned int result_wi
, expected_result_wi
;
38 unsigned long long result
, expected_result
;
39 const unsigned char mp
=1;
40 vector
unsigned char vbc_bi_src
;
41 vector
unsigned short vbc_hi_src
;
42 vector
unsigned int vbc_wi_src
;
43 vector
unsigned long long vbc_di_src
;
44 vector __uint128_t vbc_qi_src
;
58 vbc_bi_src
[10] = 0xFF;
59 vbc_bi_src
[11] = 0xFF;
60 vbc_bi_src
[12] = 0xFF;
62 vbc_bi_src
[14] = 0xFF;
63 vbc_bi_src
[15] = 0xFF;
65 expected_result_wi
= 0b1101111111000011;
67 result_wi
= vec_extractm (vbc_bi_src
);
69 if (result_wi
!= expected_result_wi
) {
71 printf("ERROR: short vec_extractm(%d) ", vbc_bi_src
);
72 printf("result %llu does not match expected result = %llu\n",
73 result
, expected_result
);
81 vbc_hi_src
[0] = 0xFFFF;
82 vbc_hi_src
[1] = 0xFFFF;
87 vbc_hi_src
[6] = 0xFFFF;
88 vbc_hi_src
[7] = 0xFFFF;
90 expected_result_wi
= 0b11000011;
92 result_wi
= vec_extractm (vbc_hi_src
);
94 if (result_wi
!= expected_result_wi
) {
96 printf("ERROR: short vec_extractm(%d) ", vbc_hi_src
);
97 printf("result %llu does not match expected result = %llu\n",
98 result
, expected_result
);
106 vbc_wi_src
[0] = 0xFFFFFFFF;
107 vbc_wi_src
[1] = 0xFFFFFFFF;
111 expected_result_wi
= 0b0011;
113 result_wi
= vec_extractm (vbc_wi_src
);
115 if (result_wi
!= expected_result_wi
) {
117 printf("ERROR: word vec_extractm(%d) ", vbc_wi_src
);
118 printf("result %llu does not match expected result = %llu\n",
119 result
, expected_result
);
127 vbc_di_src
[0] = 0xFFFFFFFFFFFFFFFF;
128 vbc_di_src
[1] = 0xFFFFFFFFFFFFFFFF;
130 expected_result_wi
= 0b11;
132 result_wi
= vec_extractm (vbc_di_src
);
134 if (result_wi
!= expected_result_wi
) {
136 printf("ERROR: double vec_extractm(%lld) ", vbc_di_src
);
137 printf("result %llu does not match expected result = %llu\n",
138 result
, expected_result
);
147 vbc_qi_src
[0] = vbc_qi_src
[0] << 127;
149 expected_result_wi
= 1;
151 result_wi
= vec_extractm (vbc_qi_src
);
153 if (result_wi
!= expected_result_wi
) {
155 printf("ERROR: quad vec_extractm(arg) ");
156 printf("result 0x%x does not match expected result = 0x%x\n",
157 result
, expected_result
);