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/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/ppc/frames-ppc.h" | 9 #include "src/ppc/frames-ppc.h" |
10 | 10 |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 } | 1254 } |
1255 | 1255 |
1256 | 1256 |
1257 void InstructionSelector::VisitFloat64Add(Node* node) { | 1257 void InstructionSelector::VisitFloat64Add(Node* node) { |
1258 // TODO(mbrandy): detect multiply-add | 1258 // TODO(mbrandy): detect multiply-add |
1259 VisitRRR(this, kPPC_AddDouble, node); | 1259 VisitRRR(this, kPPC_AddDouble, node); |
1260 } | 1260 } |
1261 | 1261 |
1262 | 1262 |
1263 void InstructionSelector::VisitFloat32Sub(Node* node) { | 1263 void InstructionSelector::VisitFloat32Sub(Node* node) { |
1264 PPCOperandGenerator g(this); | |
1265 Float32BinopMatcher m(node); | |
1266 if (m.left().IsMinusZero()) { | |
1267 Emit(kPPC_NegDouble | MiscField::encode(1), g.DefineAsRegister(node), | |
1268 g.UseRegister(m.right().node())); | |
1269 return; | |
1270 } | |
1271 VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node); | |
1272 } | |
1273 | |
1274 void InstructionSelector::VisitFloat32SubPreserveNan(Node* node) { | |
1275 PPCOperandGenerator g(this); | |
1276 VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node); | 1264 VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node); |
1277 } | 1265 } |
1278 | 1266 |
1279 void InstructionSelector::VisitFloat64Sub(Node* node) { | 1267 void InstructionSelector::VisitFloat64Sub(Node* node) { |
1280 // TODO(mbrandy): detect multiply-subtract | 1268 // TODO(mbrandy): detect multiply-subtract |
1281 PPCOperandGenerator g(this); | |
1282 Float64BinopMatcher m(node); | |
1283 if (m.left().IsMinusZero()) { | |
1284 if (m.right().IsFloat64RoundDown() && | |
1285 CanCover(m.node(), m.right().node())) { | |
1286 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && | |
1287 CanCover(m.right().node(), m.right().InputAt(0))) { | |
1288 Float64BinopMatcher mright0(m.right().InputAt(0)); | |
1289 if (mright0.left().IsMinusZero()) { | |
1290 // -floor(-x) = ceil(x) | |
1291 Emit(kPPC_CeilDouble, g.DefineAsRegister(node), | |
1292 g.UseRegister(mright0.right().node())); | |
1293 return; | |
1294 } | |
1295 } | |
1296 } | |
1297 Emit(kPPC_NegDouble, g.DefineAsRegister(node), | |
1298 g.UseRegister(m.right().node())); | |
1299 return; | |
1300 } | |
1301 VisitRRR(this, kPPC_SubDouble, node); | 1269 VisitRRR(this, kPPC_SubDouble, node); |
1302 } | 1270 } |
1303 | 1271 |
1304 void InstructionSelector::VisitFloat64SubPreserveNan(Node* node) { | |
1305 VisitRRR(this, kPPC_SubDouble, node); | |
1306 } | |
1307 | |
1308 void InstructionSelector::VisitFloat32Mul(Node* node) { | 1272 void InstructionSelector::VisitFloat32Mul(Node* node) { |
1309 VisitRRR(this, kPPC_MulDouble | MiscField::encode(1), node); | 1273 VisitRRR(this, kPPC_MulDouble | MiscField::encode(1), node); |
1310 } | 1274 } |
1311 | 1275 |
1312 | 1276 |
1313 void InstructionSelector::VisitFloat64Mul(Node* node) { | 1277 void InstructionSelector::VisitFloat64Mul(Node* node) { |
1314 // TODO(mbrandy): detect negate | 1278 // TODO(mbrandy): detect negate |
1315 VisitRRR(this, kPPC_MulDouble, node); | 1279 VisitRRR(this, kPPC_MulDouble, node); |
1316 } | 1280 } |
1317 | 1281 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 // static | 2038 // static |
2075 MachineOperatorBuilder::AlignmentRequirements | 2039 MachineOperatorBuilder::AlignmentRequirements |
2076 InstructionSelector::AlignmentRequirements() { | 2040 InstructionSelector::AlignmentRequirements() { |
2077 return MachineOperatorBuilder::AlignmentRequirements:: | 2041 return MachineOperatorBuilder::AlignmentRequirements:: |
2078 FullUnalignedAccessSupport(); | 2042 FullUnalignedAccessSupport(); |
2079 } | 2043 } |
2080 | 2044 |
2081 } // namespace compiler | 2045 } // namespace compiler |
2082 } // namespace internal | 2046 } // namespace internal |
2083 } // namespace v8 | 2047 } // namespace v8 |
OLD | NEW |