Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c

raw
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-additional-options "-fno-ipa-icf" } */
5 /* { dg-additional-options "-mlasx" { target loongarch*-*-*} } */
6
7 #include "tree-vect.h"
8
9 #define N 32
10
11 __attribute__ ((noinline)) void
12 foo (unsigned int *__restrict a,
13 unsigned short *__restrict b,
14 int n)
15 {
16 int i;
17
18 for (i = 0; i < n; i++)
19 a[i] = b[i] * 2333;
20
21 #pragma GCC novector
22 for (i = 0; i < n; i++)
23 if (a[i] != b[i] * 2333)
24 abort ();
25 }
26
27 __attribute__ ((noinline)) void
28 bar (unsigned int *__restrict a,
29 unsigned short *__restrict b,
30 int n)
31 {
32 int i;
33
34 for (i = 0; i < n; i++)
35 a[i] = (unsigned short) 2333 * b[i];
36
37 #pragma GCC novector
38 for (i = 0; i < n; i++)
39 if (a[i] != b[i] * (unsigned short) 2333)
40 abort ();
41 }
42
43 __attribute__ ((noinline)) void
44 baz (unsigned int *__restrict a,
45 unsigned short *__restrict b,
46 int n)
47 {
48 int i;
49
50 for (i = 0; i < n; i++)
51 a[i] = b[i] * 233333333;
52
53 #pragma GCC novector
54 for (i = 0; i < n; i++)
55 if (a[i] != b[i] * 233333333)
56 abort ();
57 }
58
59
60 int main (void)
61 {
62 int i;
63 unsigned int a[N];
64 unsigned short b[N];
65
66 check_vect ();
67
68 for (i = 0; i < N; i++)
69 {
70 a[i] = 0;
71 b[i] = i;
72 __asm__ volatile ("");
73 }
74
75 foo (a, b, N);
76 bar (a, b, N);
77 baz (a, b, N);
78 return 0;
79 }
80
81 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target vect_widen_mult_hi_to_si } } } */
82 /* { dg-final { scan-tree-dump-times {vect_recog_widen_mult_pattern: detected:[^\n]* 2333} 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
83 /* { dg-final { scan-tree-dump-times {widen_mult pattern recognized:[^\n]* = \(int\)} 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */