| 1 |
/* PR tree-optimization/111150 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O1 -fdump-tree-forwprop1 -Wno-psabi" } */ |
| 4 |
|
| 5 |
typedef int v4si __attribute((__vector_size__(4 * sizeof(int)))); |
| 6 |
|
| 7 |
/* Before the patch, VEC_COND_EXPR was generated for each statement in the |
| 8 |
function. This resulted in 3 VEC_COND_EXPR. */ |
| 9 |
v4si f1_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) { |
| 10 |
v4si X = a == b ? e : f; |
| 11 |
v4si Y = c == d ? e : f; |
| 12 |
return (X != Y); |
| 13 |
} |
| 14 |
|
| 15 |
v4si f2_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) { |
| 16 |
v4si X = a == b ? e : f; |
| 17 |
v4si Y = c == d ? e : f; |
| 18 |
return (X == Y); |
| 19 |
} |
| 20 |
|
| 21 |
v4si f3_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) { |
| 22 |
v4si X = a == b ? e : f; |
| 23 |
v4si Y = c == d ? f : e; |
| 24 |
return (X != Y); |
| 25 |
} |
| 26 |
|
| 27 |
v4si f4_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) { |
| 28 |
v4si X = a == b ? e : f; |
| 29 |
v4si Y = c == d ? f : e; |
| 30 |
return (X == Y); |
| 31 |
} |
| 32 |
|
| 33 |
/* For each testcase, should produce only one VEC_COND_EXPR for X^Y. */ |
| 34 |
/* { dg-final { scan-tree-dump-times " VEC_COND_EXPR " 4 "forwprop1" } } */ |
| 35 |
/* 2 IOR, one each for f1 and f2. |
| 36 |
2 AND, one each for f3 and f4. */ |
| 37 |
/* { dg-final { scan-tree-dump-times " & " 2 "forwprop1" } } */ |
| 38 |
/* { dg-final { scan-tree-dump-times " \\| " 2 "forwprop1" } } */ |
| 39 |
/* { dg-final { scan-tree-dump-times " \\^ " 4 "forwprop1" } } */ |
| 40 |
/* 8 eq comparisons from each of `a == b`/`c == d`. |
| 41 |
2 more to check that `e == f` |
| 42 |
2 ne comparisons to check that `e != f`. */ |
| 43 |
/* { dg-final { scan-tree-dump-times " == " 10 "forwprop1" } } */ |
| 44 |
/* { dg-final { scan-tree-dump-times " != " 2 "forwprop1" } } */ |