Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/vect/vect-over-widen-7.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 -100 | |
12 #define D -120 | |
13 #endif | |
14 | |
15 #define N 50 | |
16 | |
17 /* Both range analysis and backward propagation from the truncation show | |
18 that these calculations can be done in SIGNEDNESS short. */ | |
19 void __attribute__ ((noipa)) | |
20 f (SIGNEDNESS char *restrict a, SIGNEDNESS char *restrict b, | |
21 SIGNEDNESS char *restrict c, SIGNEDNESS char d) | |
22 { | |
23 int promoted_d = d; | |
24 for (int i = 0; i < N; ++i) | |
25 /* Deliberate use of signed >>. */ | |
26 a[i] = (b[i] + c[i] + promoted_d) >> 2; | |
27 } | |
28 | |
29 int | |
30 main (void) | |
31 { | |
32 check_vect (); | |
33 | |
34 SIGNEDNESS char a[N], b[N], c[N]; | |
35 for (int i = 0; i < N; ++i) | |
36 { | |
37 b[i] = BASE_B + i * 5; | |
38 c[i] = BASE_C + i * 4; | |
39 asm volatile ("" ::: "memory"); | |
40 } | |
41 f (a, b, c, D); | |
42 for (int i = 0; i < N; ++i) | |
43 if (a[i] != (BASE_B + BASE_C + D + i * 9) >> 2) | |
44 __builtin_abort (); | |
45 | |
46 return 0; | |
47 } | |
48 | |
49 /* { dg-final { scan-tree-dump {Splitting statement} "vect" } } */ | |
50 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* \+ } "vect" } } */ | |
51 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* >> 2} "vect" } } */ | |
52 /* { dg-final { scan-tree-dump {vect_recog_cast_forwprop_pattern: detected:[^\n]* \(signed char\)} "vect" } } */ | |
53 /* { dg-final { scan-tree-dump-not {vector[^ ]* int} "vect" } } */ | |
54 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */ |