Debian Codegraph @

gcc/testsuite/gcc.target/i386/xop-imul32widen-vector.c

raw
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" } */
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 int i32[SIZE];
17 long i64[SIZE];
18 } a, b, c, d;
19
20 void
21 imul32_to_64 (void)
22 {
23 int i;
24
25 for (i = 0; i < SIZE; i++)
26 a.i64[i] = ((long)b.i32[i]) * ((long)c.i32[i]);
27 }
28
29 int main ()
30 {
31 imul32_to_64 ();
32 exit (0);
33 }
34
35 /* { dg-final { scan-assembler "vpmuldq" } } */
36 /* { dg-final { scan-assembler "vpmacsdqh" } } */