1 /* PR tree-optimization/104992 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
5 #define vector __attribute__((vector_size(4*sizeof(int))))
8 __attribute__((noipa
)) unsigned foo(unsigned x
, unsigned y
)
10 return x
/ y
* y
== x
;
13 __attribute__((noipa
)) unsigned bar(unsigned x
, unsigned y
) {
14 return x
== x
/ y
* y
;
17 /* Signed test case. */
18 __attribute__((noipa
)) unsigned baz (int x
, int y
) {
19 return x
/ y
* y
== x
;
23 __attribute__((noipa
)) unsigned qux (unsigned x
, unsigned y
) {
24 return y
* (x
/ y
) == x
;
27 /* Test for forward propogation. */
28 __attribute__((noipa
)) unsigned corge(unsigned x
, unsigned y
) {
34 /* Test vector case. */
35 __attribute__((noipa
)) vector
int thud(vector
int x
, vector
int y
) {
36 return x
/ y
* y
== x
;
39 /* Complex type should not simplify because mod is different. */
40 __attribute__((noipa
)) int goo(_Complex
int x
, _Complex
int y
)
42 _Complex
int z
= x
/ y
;
43 _Complex
int q
= z
* y
;
48 __attribute__((noipa
)) unsigned fred (unsigned x
, unsigned y
) {
49 return y
* x
/ y
== x
;
53 __attribute__((noipa
)) unsigned waldo (unsigned x
, unsigned y
, unsigned z
) {
54 return x
/ y
* z
== x
;
57 /* { dg-final { scan-tree-dump-times " % " 9 "optimized" { target { ! vect_int_mod } } } } */
58 /* { dg-final { scan-tree-dump-times " % " 6 "optimized" { target vect_int_mod } } } */