[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-replace-word-runnable_2.c
blob153d1e3b62a443b6d1e88074f4631bc9a817c4f5
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
4 #include <altivec.h>
6 #define DEBUG 0
8 #if DEBUG
9 #include <stdio.h>
10 #endif
12 extern void abort (void);
14 int
15 main (int argc, char *argv [])
17 int i;
18 vector unsigned long long int vresult_ullint;
19 vector unsigned long long int expected_vresult_ullint;
20 vector unsigned long long int src_va_ullint;
21 unsigned int long long src_a_ullint;
23 /* Replace doubleword size chunk specified as a constant that can be
24 represented by an int. Should generate a vinsd instruction. Note, this
25 test requires command line option -flax-vector-conversions. */
26 src_a_ullint = 456;
27 src_va_ullint = (vector unsigned long long int) { 0, 11 };
28 vresult_ullint = (vector unsigned long long int) { 0, 2 };
29 expected_vresult_ullint = (vector unsigned long long int) { 0, 456 };
31 vresult_ullint = (vector unsigned long long int)
32 vec_replace_unaligned ((vector unsigned char)src_va_ullint,
33 src_a_ullint, 0);
35 if (!vec_all_eq (vresult_ullint, expected_vresult_ullint)) {
36 #if DEBUG
37 printf("ERROR, vec_replace_unaligned ((vector unsigned char)src_vb_ullint, src_a_ullint, index)\n");
38 for (i = 0; i < 2; i++)
39 printf(" vresult_ullint[%d] = %d, expected_vresult_ullint[%d] = %d\n",
40 i, vresult_ullint[i], i, expected_vresult_ullint[i]);
41 #else
42 abort();
43 #endif
46 return 0;
49 /* { dg-final { scan-assembler-times {\mvinsd\M} 1 } } */