| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/s390/frames-s390.h" | 9 #include "src/s390/frames-s390.h" |
| 10 | 10 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool AutoZeroExtendsWord32ToWord64(Node* node) { | 241 bool AutoZeroExtendsWord32ToWord64(Node* node) { |
| 242 #if !V8_TARGET_ARCH_S390X | 242 #if !V8_TARGET_ARCH_S390X |
| 243 return true; | 243 return true; |
| 244 #else | 244 #else |
| 245 switch (node->opcode()) { | 245 switch (node->opcode()) { |
| 246 case IrOpcode::kInt32Div: | 246 case IrOpcode::kInt32Div: |
| 247 case IrOpcode::kUint32Div: | 247 case IrOpcode::kUint32Div: |
| 248 case IrOpcode::kInt32MulHigh: | 248 case IrOpcode::kInt32MulHigh: |
| 249 case IrOpcode::kUint32MulHigh: |
| 249 case IrOpcode::kInt32Mod: | 250 case IrOpcode::kInt32Mod: |
| 250 case IrOpcode::kUint32Mod: | 251 case IrOpcode::kUint32Mod: |
| 252 case IrOpcode::kWord32Clz: |
| 253 case IrOpcode::kWord32Popcnt: |
| 251 return true; | 254 return true; |
| 252 default: | 255 default: |
| 253 return false; | 256 return false; |
| 254 } | 257 } |
| 255 return false; | 258 return false; |
| 256 #endif | 259 #endif |
| 257 } | 260 } |
| 258 | 261 |
| 259 bool ZeroExtendsWord32ToWord64(Node* node) { | 262 bool ZeroExtendsWord32ToWord64(Node* node) { |
| 260 #if !V8_TARGET_ARCH_S390X | 263 #if !V8_TARGET_ARCH_S390X |
| 261 return true; | 264 return true; |
| 262 #else | 265 #else |
| 263 switch (node->opcode()) { | 266 switch (node->opcode()) { |
| 264 case IrOpcode::kInt32Add: | 267 case IrOpcode::kInt32Add: |
| 265 case IrOpcode::kInt32Sub: | 268 case IrOpcode::kInt32Sub: |
| 266 case IrOpcode::kWord32And: | 269 case IrOpcode::kWord32And: |
| 267 case IrOpcode::kWord32Or: | 270 case IrOpcode::kWord32Or: |
| 268 case IrOpcode::kWord32Xor: | 271 case IrOpcode::kWord32Xor: |
| 269 case IrOpcode::kWord32Shl: | 272 case IrOpcode::kWord32Shl: |
| 270 case IrOpcode::kWord32Shr: | 273 case IrOpcode::kWord32Shr: |
| 271 case IrOpcode::kWord32Sar: | 274 case IrOpcode::kWord32Sar: |
| 272 case IrOpcode::kInt32Mul: | 275 case IrOpcode::kInt32Mul: |
| 273 case IrOpcode::kWord32Ror: | 276 case IrOpcode::kWord32Ror: |
| 274 case IrOpcode::kInt32Div: | 277 case IrOpcode::kInt32Div: |
| 275 case IrOpcode::kUint32Div: | 278 case IrOpcode::kUint32Div: |
| 276 case IrOpcode::kInt32MulHigh: | 279 case IrOpcode::kInt32MulHigh: |
| 277 case IrOpcode::kInt32Mod: | 280 case IrOpcode::kInt32Mod: |
| 278 case IrOpcode::kUint32Mod: | 281 case IrOpcode::kUint32Mod: |
| 282 case IrOpcode::kWord32Popcnt: |
| 279 return true; | 283 return true; |
| 280 // TODO(john.yan): consider the following case to be valid | 284 // TODO(john.yan): consider the following case to be valid |
| 281 // case IrOpcode::kWord32Equal: | 285 // case IrOpcode::kWord32Equal: |
| 282 // case IrOpcode::kInt32LessThan: | 286 // case IrOpcode::kInt32LessThan: |
| 283 // case IrOpcode::kInt32LessThanOrEqual: | 287 // case IrOpcode::kInt32LessThanOrEqual: |
| 284 // case IrOpcode::kUint32LessThan: | 288 // case IrOpcode::kUint32LessThan: |
| 285 // case IrOpcode::kUint32LessThanOrEqual: | 289 // case IrOpcode::kUint32LessThanOrEqual: |
| 286 // case IrOpcode::kUint32MulHigh: | 290 // case IrOpcode::kUint32MulHigh: |
| 287 // // These 32-bit operations implicitly zero-extend to 64-bit on x64, so | 291 // // These 32-bit operations implicitly zero-extend to 64-bit on x64, so |
| 288 // the | 292 // the |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 OperandMode::kAllowRRI | OperandMode::kShift32Imm); | 1145 OperandMode::kAllowRRI | OperandMode::kShift32Imm); |
| 1142 } | 1146 } |
| 1143 | 1147 |
| 1144 #if V8_TARGET_ARCH_S390X | 1148 #if V8_TARGET_ARCH_S390X |
| 1145 void InstructionSelector::VisitWord64Ror(Node* node) { | 1149 void InstructionSelector::VisitWord64Ror(Node* node) { |
| 1146 VisitRRO(this, kS390_RotRight64, node, OperandMode::kShift64Imm); | 1150 VisitRRO(this, kS390_RotRight64, node, OperandMode::kShift64Imm); |
| 1147 } | 1151 } |
| 1148 #endif | 1152 #endif |
| 1149 | 1153 |
| 1150 void InstructionSelector::VisitWord32Clz(Node* node) { | 1154 void InstructionSelector::VisitWord32Clz(Node* node) { |
| 1151 S390OperandGenerator g(this); | 1155 VisitRR(this, kS390_Cntlz32, node); |
| 1152 Emit(kS390_Cntlz32, g.DefineAsRegister(node), | |
| 1153 g.UseRegister(node->InputAt(0))); | |
| 1154 } | 1156 } |
| 1155 | 1157 |
| 1156 #if V8_TARGET_ARCH_S390X | 1158 #if V8_TARGET_ARCH_S390X |
| 1157 void InstructionSelector::VisitWord64Clz(Node* node) { | 1159 void InstructionSelector::VisitWord64Clz(Node* node) { |
| 1158 S390OperandGenerator g(this); | 1160 S390OperandGenerator g(this); |
| 1159 Emit(kS390_Cntlz64, g.DefineAsRegister(node), | 1161 Emit(kS390_Cntlz64, g.DefineAsRegister(node), |
| 1160 g.UseRegister(node->InputAt(0))); | 1162 g.UseRegister(node->InputAt(0))); |
| 1161 } | 1163 } |
| 1162 #endif | 1164 #endif |
| 1163 | 1165 |
| 1164 void InstructionSelector::VisitWord32Popcnt(Node* node) { | 1166 void InstructionSelector::VisitWord32Popcnt(Node* node) { |
| 1165 S390OperandGenerator g(this); | 1167 S390OperandGenerator g(this); |
| 1166 Emit(kS390_Popcnt32, g.DefineAsRegister(node), | 1168 Node* value = node->InputAt(0); |
| 1167 g.UseRegister(node->InputAt(0))); | 1169 Emit(kS390_Popcnt32, g.DefineAsRegister(node), g.UseRegister(value)); |
| 1168 } | 1170 } |
| 1169 | 1171 |
| 1170 #if V8_TARGET_ARCH_S390X | 1172 #if V8_TARGET_ARCH_S390X |
| 1171 void InstructionSelector::VisitWord64Popcnt(Node* node) { | 1173 void InstructionSelector::VisitWord64Popcnt(Node* node) { |
| 1172 S390OperandGenerator g(this); | 1174 S390OperandGenerator g(this); |
| 1173 Emit(kS390_Popcnt64, g.DefineAsRegister(node), | 1175 Emit(kS390_Popcnt64, g.DefineAsRegister(node), |
| 1174 g.UseRegister(node->InputAt(0))); | 1176 g.UseRegister(node->InputAt(0))); |
| 1175 } | 1177 } |
| 1176 #endif | 1178 #endif |
| 1177 | 1179 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 VisitMul(this, node, kS390_Mul64); | 1326 VisitMul(this, node, kS390_Mul64); |
| 1325 } | 1327 } |
| 1326 #endif | 1328 #endif |
| 1327 | 1329 |
| 1328 void InstructionSelector::VisitInt32MulHigh(Node* node) { | 1330 void InstructionSelector::VisitInt32MulHigh(Node* node) { |
| 1329 VisitBin32op(this, node, kS390_MulHigh32, | 1331 VisitBin32op(this, node, kS390_MulHigh32, |
| 1330 OperandMode::kInt32Imm | OperandMode::kAllowDistinctOps); | 1332 OperandMode::kInt32Imm | OperandMode::kAllowDistinctOps); |
| 1331 } | 1333 } |
| 1332 | 1334 |
| 1333 void InstructionSelector::VisitUint32MulHigh(Node* node) { | 1335 void InstructionSelector::VisitUint32MulHigh(Node* node) { |
| 1334 S390OperandGenerator g(this); | 1336 VisitBin32op(this, node, kS390_MulHighU32, |
| 1335 Int32BinopMatcher m(node); | 1337 OperandMode::kAllowRRM | OperandMode::kAllowRRR); |
| 1336 Node* left = m.left().node(); | |
| 1337 Node* right = m.right().node(); | |
| 1338 if (g.CanBeBetterLeftOperand(right)) { | |
| 1339 std::swap(left, right); | |
| 1340 } | |
| 1341 Emit(kS390_MulHighU32, g.DefineAsRegister(node), g.UseRegister(left), | |
| 1342 g.Use(right)); | |
| 1343 } | 1338 } |
| 1344 | 1339 |
| 1345 void InstructionSelector::VisitInt32Div(Node* node) { | 1340 void InstructionSelector::VisitInt32Div(Node* node) { |
| 1346 VisitBin32op(this, node, kS390_Div32, | 1341 VisitBin32op(this, node, kS390_Div32, |
| 1347 OperandMode::kAllowRRM | OperandMode::kAllowRRR); | 1342 OperandMode::kAllowRRM | OperandMode::kAllowRRR); |
| 1348 } | 1343 } |
| 1349 | 1344 |
| 1350 #if V8_TARGET_ARCH_S390X | 1345 #if V8_TARGET_ARCH_S390X |
| 1351 void InstructionSelector::VisitInt64Div(Node* node) { | 1346 void InstructionSelector::VisitInt64Div(Node* node) { |
| 1352 VisitRRR(this, kS390_Div64, node); | 1347 VisitRRR(this, kS390_Div64, node); |
| 1353 } | 1348 } |
| 1354 #endif | 1349 #endif |
| 1355 | 1350 |
| 1356 void InstructionSelector::VisitUint32Div(Node* node) { | 1351 void InstructionSelector::VisitUint32Div(Node* node) { |
| 1357 VisitBin32op(this, node, kS390_DivU32, | 1352 VisitBin32op(this, node, kS390_DivU32, |
| 1358 OperandMode::kAllowRRM | OperandMode::kAllowRRR); | 1353 OperandMode::kAllowRRM | OperandMode::kAllowRRR); |
| 1359 } | 1354 } |
| 1360 | 1355 |
| 1361 #if V8_TARGET_ARCH_S390X | 1356 #if V8_TARGET_ARCH_S390X |
| 1362 void InstructionSelector::VisitUint64Div(Node* node) { | 1357 void InstructionSelector::VisitUint64Div(Node* node) { |
| 1363 VisitRRR(this, kS390_DivU64, node); | 1358 VisitRRR(this, kS390_DivU64, node); |
| 1364 } | 1359 } |
| 1365 #endif | 1360 #endif |
| 1366 | 1361 |
| 1367 void InstructionSelector::VisitInt32Mod(Node* node) { | 1362 void InstructionSelector::VisitInt32Mod(Node* node) { |
| 1368 VisitRRR(this, kS390_Mod32, node); | 1363 VisitBin32op(this, node, kS390_Mod32, |
| 1364 OperandMode::kAllowRRM | OperandMode::kAllowRRR); |
| 1369 } | 1365 } |
| 1370 | 1366 |
| 1371 #if V8_TARGET_ARCH_S390X | 1367 #if V8_TARGET_ARCH_S390X |
| 1372 void InstructionSelector::VisitInt64Mod(Node* node) { | 1368 void InstructionSelector::VisitInt64Mod(Node* node) { |
| 1373 VisitRRR(this, kS390_Mod64, node); | 1369 VisitRRR(this, kS390_Mod64, node); |
| 1374 } | 1370 } |
| 1375 #endif | 1371 #endif |
| 1376 | 1372 |
| 1377 void InstructionSelector::VisitUint32Mod(Node* node) { | 1373 void InstructionSelector::VisitUint32Mod(Node* node) { |
| 1378 VisitRRR(this, kS390_ModU32, node); | 1374 VisitBin32op(this, node, kS390_ModU32, |
| 1375 OperandMode::kAllowRRM | OperandMode::kAllowRRR); |
| 1379 } | 1376 } |
| 1380 | 1377 |
| 1381 #if V8_TARGET_ARCH_S390X | 1378 #if V8_TARGET_ARCH_S390X |
| 1382 void InstructionSelector::VisitUint64Mod(Node* node) { | 1379 void InstructionSelector::VisitUint64Mod(Node* node) { |
| 1383 VisitRRR(this, kS390_ModU64, node); | 1380 VisitRRR(this, kS390_ModU64, node); |
| 1384 } | 1381 } |
| 1385 #endif | 1382 #endif |
| 1386 | 1383 |
| 1387 void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) { | 1384 void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) { |
| 1388 VisitRR(this, kS390_Float32ToDouble, node); | 1385 VisitRR(this, kS390_Float32ToDouble, node); |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 // static | 2297 // static |
| 2301 MachineOperatorBuilder::AlignmentRequirements | 2298 MachineOperatorBuilder::AlignmentRequirements |
| 2302 InstructionSelector::AlignmentRequirements() { | 2299 InstructionSelector::AlignmentRequirements() { |
| 2303 return MachineOperatorBuilder::AlignmentRequirements:: | 2300 return MachineOperatorBuilder::AlignmentRequirements:: |
| 2304 FullUnalignedAccessSupport(); | 2301 FullUnalignedAccessSupport(); |
| 2305 } | 2302 } |
| 2306 | 2303 |
| 2307 } // namespace compiler | 2304 } // namespace compiler |
| 2308 } // namespace internal | 2305 } // namespace internal |
| 2309 } // namespace v8 | 2306 } // namespace v8 |
| OLD | NEW |