Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/vect/vect-over-widen-13.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* { dg-require-effective-target vect_int } */ | |
2 /* { dg-require-effective-target vect_shift } */ | |
3 /* { dg-require-effective-target vect_pack_trunc } */ | |
4 /* { dg-require-effective-target vect_unpack } */ | |
5 | |
6 #include "tree-vect.h" | |
7 | |
8 #ifndef SIGNEDNESS | |
9 #define SIGNEDNESS signed | |
10 #define BASE_B -128 | |
11 #define BASE_C -120 | |
12 #endif | |
13 | |
14 #define N 50 | |
15 | |
16 /* We rely on range analysis to show that these calculations can be done | |
17 in SIGNEDNESS short. */ | |
18 void __attribute__ ((noipa)) | |
19 f (SIGNEDNESS char *restrict a, SIGNEDNESS char *restrict b, | |
20 SIGNEDNESS char *restrict c) | |
21 { | |
22 for (int i = 0; i < N; ++i) | |
23 a[i] = (b[i] + c[i]) / 2; | |
24 } | |
25 | |
26 int | |
27 main (void) | |
28 { | |
29 check_vect (); | |
30 | |
31 SIGNEDNESS char a[N], b[N], c[N]; | |
32 for (int i = 0; i < N; ++i) | |
33 { | |
34 b[i] = BASE_B + i * 5; | |
35 c[i] = BASE_C + i * 4; | |
36 asm volatile ("" ::: "memory"); | |
37 } | |
38 f (a, b, c); | |
39 for (int i = 0; i < N; ++i) | |
40 if (a[i] != (BASE_B + BASE_C + i * 9) / 2) | |
41 __builtin_abort (); | |
42 | |
43 return 0; | |
44 } | |
45 | |
46 /* { dg-final { scan-tree-dump {Splitting statement} "vect" } } */ | |
47 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* \+} "vect" } } */ | |
48 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* / 2} "vect" } } */ | |
49 /* { dg-final { scan-tree-dump {vect_recog_cast_forwprop_pattern: detected:[^\n]* = \(signed char\)} "vect" } } */ | |
50 /* { dg-final { scan-tree-dump-not {vector[^ ]* int} "vect" } } */ | |
51 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */ |