2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-maltivec" } */
5 /* This test should run the same on any target that supports altivec/dfp
6 instructions. Intentionally not specifying cpu in order to test
7 all code generation paths. */
15 check (unsigned char, unsigned char) __attribute__((__noinline__
));
17 static __attribute__((altivec(vector__
))) unsigned char
18 deoptimize (__attribute__((altivec(vector__
))) unsigned char)
19 __attribute__((__noinline__
));
21 static __attribute__((altivec(vector__
))) unsigned char
22 deoptimize (__attribute__((altivec(vector__
))) unsigned char a
)
24 __asm__ (" # %x0" : "+v" (a
));
28 // Toggle this attribute inline/noinline to see pass/fail.
29 // fails with the noinline attribute applied.
30 __attribute__ ((__noinline__
))
32 get_auto_n (__attribute__((altivec(vector__
))) unsigned char a
, size_t n
)
34 return (unsigned char) __builtin_vec_extract (a
, n
);
38 do_auto (__attribute__((altivec(vector__
))) unsigned char a
)
41 for (i
= 1; i
< 3 ; i
++)
45 printf ("get_auto_n (a, %d) produces 0x0%x\n",
46 i
, (int) get_auto_n (a
, i
));
48 if ((int) get_auto_n (a
,i
) > 250) abort();
57 __attribute__((altivec(vector__
))) unsigned char x
=
58 { 3, 2, 3, 8, 5, 6, 7, 8, 240, 241, 242, 243, 244, 245, 246, 247 };
59 __attribute__((altivec(vector__
))) unsigned char a
;
61 printf (" first elements of x are: %d %d %d %d %d\n",
62 x
[0], x
[1], x
[2], x
[3], x
[4]);
66 printf (" after deoptimization, first elements of a are: %d %d %d %d %d\n",
67 a
[0], a
[1], a
[2], a
[3], a
[4]);