| 1 |
/* Check that the rotcl instruction is generated. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-times "rotcl" 28 } } */ |
| 5 |
|
| 6 |
typedef char mybool; |
| 7 |
|
| 8 |
long long |
| 9 |
test_00 (long long a) |
| 10 |
{ |
| 11 |
return a << 1; |
| 12 |
} |
| 13 |
|
| 14 |
unsigned int |
| 15 |
test_01 (unsigned int a, int b, int c) |
| 16 |
{ |
| 17 |
mybool r = b == c; |
| 18 |
return ((a << 1) | r); |
| 19 |
} |
| 20 |
|
| 21 |
unsigned int |
| 22 |
test_02 (unsigned int a, int b, int c) |
| 23 |
{ |
| 24 |
mybool r = b == c; |
| 25 |
return ((a << 2) | r); |
| 26 |
} |
| 27 |
|
| 28 |
unsigned int |
| 29 |
test_03 (unsigned int a, int b, int c) |
| 30 |
{ |
| 31 |
mybool r = b == c; |
| 32 |
return ((a << 3) | r); |
| 33 |
} |
| 34 |
|
| 35 |
unsigned int |
| 36 |
test_04 (unsigned int a, int b, int c) |
| 37 |
{ |
| 38 |
mybool r = b == c; |
| 39 |
return ((a << 4) | r); |
| 40 |
} |
| 41 |
|
| 42 |
unsigned int |
| 43 |
test_05 (unsigned int a, int b, int c) |
| 44 |
{ |
| 45 |
mybool r = b == c; |
| 46 |
return ((a << 5) | r); |
| 47 |
} |
| 48 |
|
| 49 |
unsigned int |
| 50 |
test_06 (unsigned int a, int b, int c) |
| 51 |
{ |
| 52 |
mybool r = b == c; |
| 53 |
return ((a << 6) | r); |
| 54 |
} |
| 55 |
|
| 56 |
unsigned int |
| 57 |
test_07 (unsigned int a, int b, int c) |
| 58 |
{ |
| 59 |
mybool r = b == c; |
| 60 |
return ((a << 7) | r); |
| 61 |
} |
| 62 |
|
| 63 |
unsigned int |
| 64 |
test_08 (unsigned int a, int b, int c) |
| 65 |
{ |
| 66 |
mybool r = b == c; |
| 67 |
return ((a << 8) | r); |
| 68 |
} |
| 69 |
|
| 70 |
unsigned int |
| 71 |
test_09 (unsigned int a, int b, int c) |
| 72 |
{ |
| 73 |
mybool r = b == c; |
| 74 |
return ((a << 31) | r); |
| 75 |
} |
| 76 |
|
| 77 |
unsigned int |
| 78 |
test_10 (unsigned int a, int b) |
| 79 |
{ |
| 80 |
/* 1x shlr, 1x rotcl */ |
| 81 |
return (a << 1) | (b & 1); |
| 82 |
} |
| 83 |
|
| 84 |
unsigned int |
| 85 |
test_11 (unsigned int a, int b) |
| 86 |
{ |
| 87 |
/* 1x shlr, 1x rotcl (+1x add as shll) */ |
| 88 |
return (a << 2) | (b & 1); |
| 89 |
} |
| 90 |
|
| 91 |
unsigned int |
| 92 |
test_12 (unsigned int a, int b) |
| 93 |
{ |
| 94 |
/* 1x shlr, 1x shll2, 1x rotcl */ |
| 95 |
return (a << 3) | (b & 1); |
| 96 |
} |
| 97 |
|
| 98 |
unsigned int |
| 99 |
test_13 (unsigned int a, int b) |
| 100 |
{ |
| 101 |
/* 1x shll, 1x rotcl */ |
| 102 |
mybool r = b < 0; |
| 103 |
return (a << 1) | r; |
| 104 |
} |
| 105 |
|
| 106 |
unsigned int |
| 107 |
test_14 (unsigned int a, int b, int c) |
| 108 |
{ |
| 109 |
mybool r = b != c; |
| 110 |
return ((a << 1) | r); |
| 111 |
} |
| 112 |
|
| 113 |
unsigned int |
| 114 |
test_15 (unsigned int a, int b, int c) |
| 115 |
{ |
| 116 |
mybool r = b != c; |
| 117 |
return ((a << 11) | r); |
| 118 |
} |
| 119 |
|
| 120 |
unsigned int |
| 121 |
test_16 (unsigned int a, int b, int c) |
| 122 |
{ |
| 123 |
mybool r = b != c; |
| 124 |
return ((a << 3) | r); |
| 125 |
} |
| 126 |
|
| 127 |
unsigned int |
| 128 |
test_17 (unsigned int a, int b, int c) |
| 129 |
{ |
| 130 |
mybool r = b != c; |
| 131 |
return ((a << 4) | r); |
| 132 |
} |
| 133 |
|
| 134 |
unsigned int |
| 135 |
test_18 (unsigned int a, int b, int c) |
| 136 |
{ |
| 137 |
mybool r = b != c; |
| 138 |
return ((a << 5) | r); |
| 139 |
} |
| 140 |
|
| 141 |
unsigned int |
| 142 |
test_19 (unsigned int a, int b, int c) |
| 143 |
{ |
| 144 |
mybool r = b != c; |
| 145 |
return ((a << 6) | r); |
| 146 |
} |
| 147 |
|
| 148 |
unsigned int |
| 149 |
test_20 (unsigned int a, int b, int c) |
| 150 |
{ |
| 151 |
mybool r = b != c; |
| 152 |
return ((a << 7) | r); |
| 153 |
} |
| 154 |
|
| 155 |
unsigned int |
| 156 |
test_21 (unsigned int a, int b, int c) |
| 157 |
{ |
| 158 |
mybool r = b != c; |
| 159 |
return ((a << 8) | r); |
| 160 |
} |
| 161 |
|
| 162 |
unsigned int |
| 163 |
test_22 (unsigned int a, int b, int c) |
| 164 |
{ |
| 165 |
mybool r = b != c; |
| 166 |
return ((a << 31) | r); |
| 167 |
} |
| 168 |
|
| 169 |
unsigned int |
| 170 |
test_23 (unsigned int a, int b, int c) |
| 171 |
{ |
| 172 |
/* 1x shll, 1x rotcl */ |
| 173 |
return (a >> 31) | (b << 13); |
| 174 |
} |
| 175 |
|
| 176 |
unsigned int |
| 177 |
test_24 (unsigned int a, unsigned int b) |
| 178 |
{ |
| 179 |
/* 1x shll, 1x rotcl */ |
| 180 |
return (a >> 31) | (b << 1); |
| 181 |
} |
| 182 |
|
| 183 |
unsigned int |
| 184 |
test_25 (unsigned int a, unsigned int b) |
| 185 |
{ |
| 186 |
/* 1x shll, 1x rotcl */ |
| 187 |
return (a >> 31) | (b << 3); |
| 188 |
} |
| 189 |
|
| 190 |
unsigned int |
| 191 |
test_26 (unsigned int a, unsigned int b) |
| 192 |
{ |
| 193 |
/* 1x shll, 1x rotcl */ |
| 194 |
return (b << 3) | (a >> 31); |
| 195 |
} |
| 196 |
|
| 197 |
unsigned int |
| 198 |
test_27 (unsigned int a, unsigned int b) |
| 199 |
{ |
| 200 |
/* 1x shlr, 1x rotcl */ |
| 201 |
return (a << 1) | ((b >> 4) & 1); |
| 202 |
} |