1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_float } */
3 /* { dg-require-effective-target powerpc_altivec_ok { target { powerpc*-*-* } } } */
4 /* { dg-require-effective-target sse2 { target { i?86-*-* x86_64-*-* } } } */
5 /* { dg-additional-options "-O2 -ffast-math -fdump-tree-reassoc1" } */
6 /* { dg-additional-options "-maltivec" { target { powerpc*-*-* } } } */
7 /* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
9 /* To test reassoc can undistribute vector bit_field_ref on multiplication.
11 v1, v2, v3, v4 of type vector float.
15 accumulator *= v1[0] * v1[1] * v1[2] * v1[3] *
16 v2[0] * v2[1] * v2[2] * v2[3] *
17 v3[0] * v3[1] * v3[2] * v3[3] *
18 v4[0] * v4[1] * v4[2] * v4[3] ;
22 T = v1 * v2 * v3 * v4;
23 accumulator *= T[0] * T[1] * T[2] * T[3];
25 Fewer bit_field_refs, only four for 128 or more bits vector. */
27 typedef float v4sf
__attribute__ ((vector_size (16)));
29 test (float accumulator
, v4sf v1
, v4sf v2
, v4sf v3
, v4sf v4
)
31 accumulator
*= v1
[0] * v1
[1] * v1
[2] * v1
[3];
32 accumulator
*= v2
[0] * v2
[1] * v2
[2] * v2
[3];
33 accumulator
*= v3
[0] * v3
[1] * v3
[2] * v3
[3];
34 accumulator
*= v4
[0] * v4
[1] * v4
[2] * v4
[3];
37 /* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 4 "reassoc1" { target { powerpc*-*-* i?86-*-* x86_64-*-* } } } } */