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 } */
9 #define SIGNEDNESS signed
16 /* Both range analysis and backward propagation from the truncation show
17 that these calculations can be done in SIGNEDNESS short. */
18 void __attribute__ ((noipa
))
19 f (SIGNEDNESS
char *restrict a
, SIGNEDNESS
char *restrict b
,
20 SIGNEDNESS
char *restrict c
)
22 /* Deliberate use of signed >>. */
23 for (int i
= 0; i
< N
; ++i
)
24 a
[i
] = (b
[i
] + c
[i
]) >> 1;
32 SIGNEDNESS
char a
[N
], b
[N
], c
[N
];
33 for (int i
= 0; i
< N
; ++i
)
35 b
[i
] = BASE_B
+ i
* 5;
36 c
[i
] = BASE_C
+ i
* 4;
37 asm volatile ("" ::: "memory");
41 for (int i
= 0; i
< N
; ++i
)
42 if (a
[i
] != (BASE_B
+ BASE_C
+ i
* 9) >> 1)
48 /* { dg-final { scan-tree-dump {Splitting statement} "vect" } } */
49 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* \+ } "vect" } } */
50 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* >> 1} "vect" } } */
51 /* { dg-final { scan-tree-dump {vect_recog_cast_forwprop_pattern: detected:[^\n]* \(signed char\)} "vect" } } */
52 /* { dg-final { scan-tree-dump-not {vector[^ ]* int} "vect" } } */
53 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */