| 1 |
/* PR tree-optimization/21643 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-reassoc1-details --param logical-op-non-short-circuit=1" } */ |
| 4 |
|
| 5 |
int |
| 6 |
f1 (unsigned char c) |
| 7 |
{ |
| 8 |
if (c == 0x22 || c == 0x20 || c < 0x20) |
| 9 |
return 1; |
| 10 |
return 0; |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
f2 (unsigned char c) |
| 15 |
{ |
| 16 |
if (c == 0x22 || c <= 0x20) |
| 17 |
return 1; |
| 18 |
return 0; |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
f3 (unsigned char c) |
| 23 |
{ |
| 24 |
if (c == 0x22) |
| 25 |
return 1; |
| 26 |
if (c == 0x20) |
| 27 |
return 1; |
| 28 |
if (c < 0x20) |
| 29 |
return 1; |
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
int |
| 34 |
f4 (unsigned char c) |
| 35 |
{ |
| 36 |
if (c == 0x22 || c == 0x20 || c < 0x20) |
| 37 |
return 2; |
| 38 |
return 0; |
| 39 |
} |
| 40 |
|
| 41 |
int |
| 42 |
f5 (unsigned char c) |
| 43 |
{ |
| 44 |
if (c == 0x22 || c <= 0x20) |
| 45 |
return 2; |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
int |
| 50 |
f6 (unsigned char c) |
| 51 |
{ |
| 52 |
if (c == 0x22) |
| 53 |
return 2; |
| 54 |
if (c == 0x20) |
| 55 |
return 2; |
| 56 |
if (c < 0x20) |
| 57 |
return 2; |
| 58 |
return 0; |
| 59 |
} |
| 60 |
|
| 61 |
int |
| 62 |
f7 (unsigned char c) |
| 63 |
{ |
| 64 |
if (c != 0x22 && c != 0x20 && c >= 0x20) |
| 65 |
return 0; |
| 66 |
return 1; |
| 67 |
} |
| 68 |
|
| 69 |
int |
| 70 |
f8 (unsigned char c) |
| 71 |
{ |
| 72 |
if (c == 0x22 && c <= 0x20) |
| 73 |
return 0; |
| 74 |
return 1; |
| 75 |
} |
| 76 |
|
| 77 |
int |
| 78 |
f9 (unsigned char c) |
| 79 |
{ |
| 80 |
if (c == 0x22) |
| 81 |
return 0; |
| 82 |
if (c == 0x20) |
| 83 |
return 0; |
| 84 |
if (c < 0x20) |
| 85 |
return 0; |
| 86 |
return 1; |
| 87 |
} |
| 88 |
|
| 89 |
/* Note with match being able to simplify this, optimizing range tests is no longer needed here. */ |
| 90 |
/* Equivalence: _7 | _2 -> c_5(D) <= 32 */ |
| 91 |
/* old test: dg-final scan-tree-dump-times "Optimizing range tests c_\[0-9\]*.D. -.0, 31. and -.32, 32.\[\n\r\]* into" 6 "reassoc1" */ |
| 92 |
/* { dg-final { scan-tree-dump-times "Equivalence: _\[0-9\]+ \\\| _\[0-9\]+ -> c_\[0-9\]+.D. <= 32" 5 "reassoc1" } } */ |
| 93 |
/* { dg-final { scan-tree-dump-times "Equivalence: _\[0-9\]+ \& _\[0-9\]+ -> c_\[0-9\]+.D. > 32" 1 "reassoc1" } } */ |