1 /* Test that the compiler properly optimizes floating point multiply and add
2    instructions vector into pmacsdd/etc. on XOP systems.  */
3 
4 /* { dg-do compile } */
5 /* { dg-require-effective-target lp64 } */
6 /* { dg-options "-O2 -mxop -mno-avx2 -ftree-vectorize -fno-vect-cost-model" } */
7 
8 extern void exit (int);
9 
10 typedef long __m128i  __attribute__ ((__vector_size__ (16), __may_alias__));
11 
12 #define SIZE 10240
13 
14 union {
15   __m128i i_align;
16   long i64[SIZE];
17 } a, b, c, d;
18 
19 void
imul64(void)20 imul64 (void)
21 {
22   int i;
23 
24   for (i = 0; i < SIZE; i++)
25     a.i64[i] = b.i64[i] * c.i64[i];
26 }
27 
main()28 int main ()
29 {
30   imul64 ();
31   exit (0);
32 }
33 
34 /* { dg-final { scan-assembler "vpmulld" } } */
35 /* { dg-final { scan-assembler "vphadddq" } } */
36