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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Abs, kSSEFloat64Abs); | 1219 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Abs, kSSEFloat64Abs); |
1220 } | 1220 } |
1221 | 1221 |
1222 | 1222 |
1223 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 1223 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
1224 VisitRO(this, node, kSSEFloat64Sqrt); | 1224 VisitRO(this, node, kSSEFloat64Sqrt); |
1225 } | 1225 } |
1226 | 1226 |
1227 | 1227 |
1228 void InstructionSelector::VisitFloat32RoundDown(Node* node) { | 1228 void InstructionSelector::VisitFloat32RoundDown(Node* node) { |
1229 X64OperandGenerator g(this); | 1229 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundDown)); |
1230 Emit(kSSEFloat32Round | MiscField::encode(kRoundDown), | |
1231 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1232 } | 1230 } |
1233 | 1231 |
1234 | 1232 |
1235 void InstructionSelector::VisitFloat64RoundDown(Node* node) { | 1233 void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
1236 X64OperandGenerator g(this); | 1234 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown)); |
1237 Emit(kSSEFloat64Round | MiscField::encode(kRoundDown), | |
1238 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1239 } | 1235 } |
1240 | 1236 |
1241 | 1237 |
1242 void InstructionSelector::VisitFloat32RoundUp(Node* node) { | 1238 void InstructionSelector::VisitFloat32RoundUp(Node* node) { |
1243 X64OperandGenerator g(this); | 1239 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundUp)); |
1244 Emit(kSSEFloat32Round | MiscField::encode(kRoundUp), | |
1245 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1246 } | 1240 } |
1247 | 1241 |
1248 | 1242 |
1249 void InstructionSelector::VisitFloat64RoundUp(Node* node) { | 1243 void InstructionSelector::VisitFloat64RoundUp(Node* node) { |
1250 X64OperandGenerator g(this); | 1244 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundUp)); |
1251 Emit(kSSEFloat64Round | MiscField::encode(kRoundUp), | |
1252 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1253 } | 1245 } |
1254 | 1246 |
1255 | 1247 |
1256 void InstructionSelector::VisitFloat32RoundTruncate(Node* node) { | 1248 void InstructionSelector::VisitFloat32RoundTruncate(Node* node) { |
1257 X64OperandGenerator g(this); | 1249 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToZero)); |
1258 Emit(kSSEFloat32Round | MiscField::encode(kRoundToZero), | |
1259 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1260 } | 1250 } |
1261 | 1251 |
1262 | 1252 |
1263 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 1253 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
1264 X64OperandGenerator g(this); | 1254 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero)); |
1265 Emit(kSSEFloat64Round | MiscField::encode(kRoundToZero), | |
1266 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1267 } | 1255 } |
1268 | 1256 |
1269 | 1257 |
1270 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1258 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
1271 UNREACHABLE(); | 1259 UNREACHABLE(); |
1272 } | 1260 } |
1273 | 1261 |
1274 | 1262 |
1275 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { | 1263 void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { |
1276 X64OperandGenerator g(this); | 1264 VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); |
1277 Emit(kSSEFloat32Round | MiscField::encode(kRoundToNearest), | |
1278 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1279 } | 1265 } |
1280 | 1266 |
1281 | 1267 |
1282 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { | 1268 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
1283 X64OperandGenerator g(this); | 1269 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); |
1284 Emit(kSSEFloat64Round | MiscField::encode(kRoundToNearest), | |
1285 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0))); | |
1286 } | 1270 } |
1287 | 1271 |
1288 | 1272 |
1289 void InstructionSelector::EmitPrepareArguments( | 1273 void InstructionSelector::EmitPrepareArguments( |
1290 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, | 1274 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, |
1291 Node* node) { | 1275 Node* node) { |
1292 X64OperandGenerator g(this); | 1276 X64OperandGenerator g(this); |
1293 | 1277 |
1294 // Prepare for C function call. | 1278 // Prepare for C function call. |
1295 if (descriptor->IsCFunctionCall()) { | 1279 if (descriptor->IsCFunctionCall()) { |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 | 1792 |
1809 // static | 1793 // static |
1810 MachineOperatorBuilder::Flags | 1794 MachineOperatorBuilder::Flags |
1811 InstructionSelector::SupportedMachineOperatorFlags() { | 1795 InstructionSelector::SupportedMachineOperatorFlags() { |
1812 MachineOperatorBuilder::Flags flags = | 1796 MachineOperatorBuilder::Flags flags = |
1813 MachineOperatorBuilder::kFloat32Max | | 1797 MachineOperatorBuilder::kFloat32Max | |
1814 MachineOperatorBuilder::kFloat32Min | | 1798 MachineOperatorBuilder::kFloat32Min | |
1815 MachineOperatorBuilder::kFloat64Max | | 1799 MachineOperatorBuilder::kFloat64Max | |
1816 MachineOperatorBuilder::kFloat64Min | | 1800 MachineOperatorBuilder::kFloat64Min | |
1817 MachineOperatorBuilder::kWord32ShiftIsSafe | | 1801 MachineOperatorBuilder::kWord32ShiftIsSafe | |
1818 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz | | 1802 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz; |
1819 MachineOperatorBuilder::kFloat32RoundDown | | |
1820 MachineOperatorBuilder::kFloat32RoundUp | | |
1821 MachineOperatorBuilder::kFloat32RoundTruncate | | |
1822 MachineOperatorBuilder::kFloat32RoundTiesEven | | |
1823 MachineOperatorBuilder::kFloat64RoundDown | | |
1824 MachineOperatorBuilder::kFloat64RoundUp | | |
1825 MachineOperatorBuilder::kFloat64RoundTruncate | | |
1826 MachineOperatorBuilder::kFloat64RoundTiesEven; | |
1827 if (CpuFeatures::IsSupported(POPCNT)) { | 1803 if (CpuFeatures::IsSupported(POPCNT)) { |
1828 flags |= MachineOperatorBuilder::kWord32Popcnt | | 1804 flags |= MachineOperatorBuilder::kWord32Popcnt | |
1829 MachineOperatorBuilder::kWord64Popcnt; | 1805 MachineOperatorBuilder::kWord64Popcnt; |
1830 } | 1806 } |
| 1807 if (CpuFeatures::IsSupported(SSE4_1)) { |
| 1808 flags |= MachineOperatorBuilder::kFloat32RoundDown | |
| 1809 MachineOperatorBuilder::kFloat64RoundDown | |
| 1810 MachineOperatorBuilder::kFloat32RoundUp | |
| 1811 MachineOperatorBuilder::kFloat64RoundUp | |
| 1812 MachineOperatorBuilder::kFloat32RoundTruncate | |
| 1813 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1814 MachineOperatorBuilder::kFloat32RoundTiesEven | |
| 1815 MachineOperatorBuilder::kFloat64RoundTiesEven; |
| 1816 } |
1831 return flags; | 1817 return flags; |
1832 } | 1818 } |
1833 | 1819 |
1834 } // namespace compiler | 1820 } // namespace compiler |
1835 } // namespace internal | 1821 } // namespace internal |
1836 } // namespace v8 | 1822 } // namespace v8 |
OLD | NEW |