[12/n] PR85694: Rework detection of widened operations
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-1.c
blob0d6e64081a17fed8d9b9239f9ba02ffa1b7a758d
1 /* { dg-require-effective-target vect_int } */
3 #include "tree-vect.h"
5 #define N 50
7 #ifndef SIGNEDNESS_1
8 #define SIGNEDNESS_1 unsigned
9 #define SIGNEDNESS_2 signed
10 #endif
12 void __attribute__ ((noipa))
13 f (SIGNEDNESS_1 short *restrict a, SIGNEDNESS_2 char *restrict b,
14 SIGNEDNESS_2 char *restrict c)
16 for (__INTPTR_TYPE__ i = 0; i < N; ++i)
18 int bv = (SIGNEDNESS_2 char) b[i];
19 int cv = (SIGNEDNESS_2 char) c[i];
20 a[i] = bv * cv;
24 #define BASE ((SIGNEDNESS_2 int) -1 < 0 ? -126 : 4)
25 #define OFFSET 20
27 int
28 main (void)
30 check_vect ();
32 SIGNEDNESS_1 short a[N];
33 SIGNEDNESS_2 char b[N], c[N];
34 for (int i = 0; i < N; ++i)
36 b[i] = BASE + i * 5;
37 c[i] = BASE + OFFSET + i * 4;
38 asm volatile ("" ::: "memory");
40 f (a, b, c);
41 for (int i = 0; i < N; ++i)
42 if (a[i] != (SIGNEDNESS_1 short) ((BASE + i * 5)
43 * (BASE + OFFSET + i * 4)))
44 __builtin_abort ();
47 /* { dg-final { scan-tree-dump "vect_recog_widen_mult_pattern: detected" "vect" } } */
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_widen_mult_qi_to_hi } } } */