1 /* { dg-do compile { target { powerpc64le-*-* } } } */
2 /* { dg-options "-mdejagnu-cpu=power8 -O3" } */
3 /* { dg-final { scan-assembler "xxsldwi \[0-9\]*,\[0-9\]*,\[0-9\]*,3" } } */
4 /* { dg-final { scan-assembler-not "xxpermdi" } } */
5 
6 /* This test verifies that a vector extract operand properly has its
7    lane changed by the swap optimization.  Element 2 of LE corresponds
8    to element 1 of BE.  When doublewords are swapped, this becomes
9    element 3 of BE, so we need to shift the vector left by 3 words
10    to be able to extract the correct value from BE element zero.  */
11 
12 typedef float  v4f32 __attribute__ ((__vector_size__ (16)));
13 
14 void foo (float);
15 extern v4f32 x, y;
16 
main()17 int main() {
18   v4f32 z = x + y;
19   foo (z[2]);
20 }
21