1 /* { dg-do run { target { powerpc*-*-* && cell_hw } } } */
2 /* { dg-do compile { target { powerpc*-*-* && { ! cell_hw } } } } */
3 /* { dg-require-effective-target powerpc_ppu_ok } */
4 /* { dg-options "-O2 -maltivec -mabi=altivec -mcpu=cell" } */
8 extern void abort (void);
10 typedef short int sint16;
11 typedef signed char int8;
13 int main1(void) __attribute__((noinline));
16 sint16 test_vector[4] = { 1678, -2356, 19246, -17892 };
17 int8 test_dst[128] __attribute__(( aligned( 16 )));
18 float test_out[4] __attribute__(( aligned( 16 )));
21 for( p = 0; p < 24; ++p )
23 memset( test_dst, 0, 128 );
24 memcpy( &test_dst[p], test_vector, 8 );
26 vector float VR, VL, V;
27 /* load the righthand section of the misaligned vector */
28 VR = (vector float) vec_lvrx( 8, &test_dst[p] );
29 VL = (vector float) vec_lvlx( 0, &test_dst[p] );
30 /* Vector Shift Left Double by Octet Immediate, move the right hand section into the bytes */
31 VR = vec_vsldoi( VR, VR, 2 << 2 );
32 /* or those two together */
33 V = vec_vor( VL, VR );
35 V = (vector float) vec_vupkhsh((vector bool short)V );
36 /* fixed to float by S16_SHIFT_BITS bits */
37 V = (vector float) vec_vcfsx ((vector signed int)V, 5 );
39 vec_stvx( V, 0, &test_out[0] );
40 if (test_out[0] != 52.437500)
42 if (test_out[1] != -73.625000)
44 if (test_out[2] != 601.437500)
46 if (test_out[3] != -559.125000)