| 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*-*-*} } */ |
| 5 |
|
| 6 |
#include <stdarg.h> |
| 7 |
#include "tree-vect.h" |
| 8 |
|
| 9 |
#define N 64 |
| 10 |
|
| 11 |
unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 12 |
unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 13 |
unsigned int result[N]; |
| 14 |
|
| 15 |
/* unsigned short->unsigned int widening-mult. */ |
| 16 |
__attribute__ ((noinline)) int |
| 17 |
foo1(int len) { |
| 18 |
int i; |
| 19 |
|
| 20 |
for (i=0; i<len; i++) { |
| 21 |
result[i] = (unsigned int)(X[i] * Y[i]); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
int main (void) |
| 26 |
{ |
| 27 |
int i; |
| 28 |
|
| 29 |
check_vect (); |
| 30 |
|
| 31 |
for (i=0; i<N; i++) { |
| 32 |
X[i] = i; |
| 33 |
Y[i] = 64-i; |
| 34 |
__asm__ volatile (""); |
| 35 |
} |
| 36 |
|
| 37 |
foo1 (N); |
| 38 |
|
| 39 |
#pragma GCC novector |
| 40 |
for (i=0; i<N; i++) { |
| 41 |
if (result[i] != X[i] * Y[i]) |
| 42 |
abort (); |
| 43 |
} |
| 44 |
|
| 45 |
return 0; |
| 46 |
} |
| 47 |
|
| 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 } } } */ |
| 51 |
|