Debian Codegraph @

gcc/testsuite/gcc.dg/vect/bb-slp-pattern-1.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-mlasx" { target loongarch*-*-* } } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 8
8
9 unsigned short X[N];
10 unsigned short Y[N];
11 unsigned int result[N];
12
13 /* unsigned short->unsigned int widening-mult. */
14 __attribute__ ((noinline, noclone)) void
15 foo (void)
16 {
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]);
25 }
26
27 int main (void)
28 {
29 int i, tmp;
30
31 check_vect ();
32
33 for (i = 0; i < N; i++)
34 {
35 X[i] = i;
36 Y[i] = 64-i;
37 }
38
39 foo ();
40
41 #pragma GCC novector
42 for (i = 0; i < N; i++)
43 {
44 __asm__ volatile ("");
45 tmp = X[i] * Y[i];
46 if (result[i] != tmp)
47 abort ();
48 }
49
50 return 0;
51 }
52
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 } } } */