OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 266 matching lines...) Loading... | |
277 if (lsb + mask_width > 32) mask_width = 32 - lsb; | 277 if (lsb + mask_width > 32) mask_width = 32 - lsb; |
278 | 278 |
279 Emit(kMipsExt, g.DefineAsRegister(node), | 279 Emit(kMipsExt, g.DefineAsRegister(node), |
280 g.UseRegister(mleft.left().node()), g.TempImmediate(lsb), | 280 g.UseRegister(mleft.left().node()), g.TempImmediate(lsb), |
281 g.TempImmediate(mask_width)); | 281 g.TempImmediate(mask_width)); |
282 return; | 282 return; |
283 } | 283 } |
284 // Other cases fall through to the normal And operation. | 284 // Other cases fall through to the normal And operation. |
285 } | 285 } |
286 } | 286 } |
287 if (m.right().HasValue()) { | |
288 uint32_t mask = m.right().Value(); | |
289 uint32_t shift = base::bits::CountPopulation32(~mask); | |
290 uint32_t msb = base::bits::CountLeadingZeros32(~mask); | |
291 if (shift != 0 && shift != 32 && msb + shift == 32) { | |
292 // Insert zeros for (x >> K) << K => x & ~(2^K - 1) expression reduction | |
293 // and remove constant loading of invereted mask. | |
paul.l...
2015/12/01 17:49:34
nit: spelling of inverted.
| |
294 Emit(kMipsIns, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), | |
295 g.TempImmediate(0), g.TempImmediate(shift)); | |
296 return; | |
297 } | |
298 } | |
287 VisitBinop(this, node, kMipsAnd); | 299 VisitBinop(this, node, kMipsAnd); |
288 } | 300 } |
289 | 301 |
290 | 302 |
291 void InstructionSelector::VisitWord32Or(Node* node) { | 303 void InstructionSelector::VisitWord32Or(Node* node) { |
292 VisitBinop(this, node, kMipsOr); | 304 VisitBinop(this, node, kMipsOr); |
293 } | 305 } |
294 | 306 |
295 | 307 |
296 void InstructionSelector::VisitWord32Xor(Node* node) { | 308 void InstructionSelector::VisitWord32Xor(Node* node) { |
(...skipping 909 matching lines...) Loading... | |
1206 MachineOperatorBuilder::kFloat32Max | | 1218 MachineOperatorBuilder::kFloat32Max | |
1207 MachineOperatorBuilder::kFloat32RoundDown | | 1219 MachineOperatorBuilder::kFloat32RoundDown | |
1208 MachineOperatorBuilder::kFloat32RoundUp | | 1220 MachineOperatorBuilder::kFloat32RoundUp | |
1209 MachineOperatorBuilder::kFloat32RoundTruncate | | 1221 MachineOperatorBuilder::kFloat32RoundTruncate | |
1210 MachineOperatorBuilder::kFloat32RoundTiesEven; | 1222 MachineOperatorBuilder::kFloat32RoundTiesEven; |
1211 } | 1223 } |
1212 | 1224 |
1213 } // namespace compiler | 1225 } // namespace compiler |
1214 } // namespace internal | 1226 } // namespace internal |
1215 } // namespace v8 | 1227 } // namespace v8 |
OLD | NEW |