libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-pattern-1.c
blob5ae99225273ca5f915f60ecba3a5aaedebe46e96
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 8
9 unsigned short X[N];
10 unsigned short Y[N];
11 unsigned int result[N];
13 /* unsigned short->unsigned int widening-mult. */
14 __attribute__ ((noinline, noclone)) void
15 foo (void)
17 result[0] = (unsigned int) (X[0] * Y[0]);
18 result[1] = (unsigned int) (X[1] * Y[1]);
19 result[2] = (unsigned int) (X[2] * Y[2]);
20 result[3] = (unsigned int) (X[3] * Y[3]);
21 result[4] = (unsigned int) (X[4] * Y[4]);
22 result[5] = (unsigned int) (X[5] * Y[5]);
23 result[6] = (unsigned int) (X[6] * Y[6]);
24 result[7] = (unsigned int) (X[7] * Y[7]);
27 int main (void)
29 int i, tmp;
31 check_vect ();
33 for (i = 0; i < N; i++)
35 X[i] = i;
36 Y[i] = 64-i;
39 foo ();
41 #pragma GCC novector
42 for (i = 0; i < N; i++)
44 __asm__ volatile ("");
45 tmp = X[i] * Y[i];
46 if (result[i] != tmp)
47 abort ();
50 return 0;
53 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp2" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
54 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 8 "slp2" { target vect_widen_mult_hi_to_si_pattern } } } */
55 /* { dg-final { scan-tree-dump-times "pattern recognized" 8 "slp2" { target vect_widen_mult_hi_to_si_pattern } } } */