2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-u8-s16-s32.c
blob98f78d3b37a37b0d96a218c1962a7da8e77e0884
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 int result[N];
12 /* unsigned char * short -> int widening-mult. */
13 __attribute__ ((noinline)) int
14 foo (int len) {
15 int i;
17 for (i=0; i<len; i++) {
18 result[i] = X[i] * Y[i];
22 int main (void)
24 int i;
26 check_vect ();
28 for (i=0; i<N; i++) {
29 X[i] = i;
30 Y[i] = 64-i;
31 __asm__ volatile ("");
34 foo (N);
36 for (i=0; i<N; i++) {
37 if (result[i] != X[i] * Y[i])
38 abort ();
41 return 0;
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
45 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
46 /* { dg-final { scan-tree-dump-times "pattern recognized" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */