libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-u8-s16-s32.c
blob3baafca7b548124ae5c48fdf3c2f07c319155967
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 "-mlasx" { target loongarch*-*-*} } */
6 #include <stdarg.h>
7 #include "tree-vect.h"
9 #define N 64
11 unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12 short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 int result[N];
15 /* unsigned char * short -> int widening-mult. */
16 __attribute__ ((noinline)) int
17 foo (int len) {
18 int i;
20 for (i=0; i<len; i++) {
21 result[i] = X[i] * Y[i];
25 int main (void)
27 int i;
29 check_vect ();
31 for (i=0; i<N; i++) {
32 X[i] = i;
33 Y[i] = 64-i;
34 __asm__ volatile ("");
37 foo (N);
39 #pragma GCC novector
40 for (i=0; i<N; i++) {
41 if (result[i] != X[i] * Y[i])
42 abort ();
45 return 0;
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
49 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
50 /* { dg-final { scan-tree-dump-times "pattern recognized" 1 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */