Add documentation for musttail attribute
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-sld-modulo.c
blob8379fde2423abab4995f77f83e94a5697b9a1c3b
1 /* Test that using a character splat to set up a shift-left
2 for a doubleword vector works correctly after gimple folding. */
4 /* { dg-do run { target { p8vector_hw } } } */
5 /* { dg-options "-O2 -mvsx" } */
6 /* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */
8 #include <altivec.h>
10 typedef __vector unsigned long long vui64_t;
12 static inline vui64_t
13 vec_sldi (vui64_t vra, const unsigned int shb)
15 vui64_t lshift;
16 vui64_t result;
18 /* Note legitimate use of wrong-type splat due to expectation that only
19 lower 6-bits are read. */
20 lshift = (vui64_t) vec_splat_s8 (shb);
22 /* Vector Shift Left Doublewords based on the lower 6-bits
23 of corresponding element of lshift. */
24 result = vec_vsld (vra, lshift);
26 return result;
29 __attribute__ ((noinline)) vui64_t
30 test_sldi_4 (vui64_t a)
32 return vec_sldi (a, 4);
35 int
36 main ()
38 vui64_t x = {-256, 1025};
39 x = test_sldi_4 (x);
40 if (x[0] != -4096 || x[1] != 16400)
41 __builtin_abort ();
42 return 0;