| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler/simd-scalar-lowering.h" | 5 #include "src/compiler/simd-scalar-lowering.h" |
| 6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
| 7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.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 |
| 11 #include "src/compiler/node.h" | 11 #include "src/compiler/node.h" |
| 12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
| 13 #include "src/wasm/wasm-module.h" | 13 #include "src/wasm/wasm-module.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 namespace compiler { | 17 namespace compiler { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 static const int kNumLanes32 = 4; | 20 static const int kNumLanes32 = 4; |
| 21 static const int kNumLanes16 = 8; | 21 static const int kNumLanes16 = 8; |
| 22 static const int kNumLanes8 = 16; |
| 22 static const int32_t kMask16 = 0xffff; | 23 static const int32_t kMask16 = 0xffff; |
| 24 static const int32_t kMask8 = 0xff; |
| 23 static const int32_t kShift16 = 16; | 25 static const int32_t kShift16 = 16; |
| 26 static const int32_t kShift8 = 24; |
| 24 } // anonymous | 27 } // anonymous |
| 25 | 28 |
| 26 SimdScalarLowering::SimdScalarLowering( | 29 SimdScalarLowering::SimdScalarLowering( |
| 27 JSGraph* jsgraph, Signature<MachineRepresentation>* signature) | 30 JSGraph* jsgraph, Signature<MachineRepresentation>* signature) |
| 28 : jsgraph_(jsgraph), | 31 : jsgraph_(jsgraph), |
| 29 state_(jsgraph->graph(), 3), | 32 state_(jsgraph->graph(), 3), |
| 30 stack_(jsgraph_->zone()), | 33 stack_(jsgraph_->zone()), |
| 31 replacements_(nullptr), | 34 replacements_(nullptr), |
| 32 signature_(signature), | 35 signature_(signature), |
| 33 placeholder_(graph()->NewNode(common()->Parameter(-2, "placeholder"), | 36 placeholder_(graph()->NewNode(common()->Parameter(-2, "placeholder"), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 V(I16x8SubSaturateS) \ | 145 V(I16x8SubSaturateS) \ |
| 143 V(I16x8Mul) \ | 146 V(I16x8Mul) \ |
| 144 V(I16x8MinS) \ | 147 V(I16x8MinS) \ |
| 145 V(I16x8MaxS) \ | 148 V(I16x8MaxS) \ |
| 146 V(I16x8ShrU) \ | 149 V(I16x8ShrU) \ |
| 147 V(I16x8AddSaturateU) \ | 150 V(I16x8AddSaturateU) \ |
| 148 V(I16x8SubSaturateU) \ | 151 V(I16x8SubSaturateU) \ |
| 149 V(I16x8MinU) \ | 152 V(I16x8MinU) \ |
| 150 V(I16x8MaxU) | 153 V(I16x8MaxU) |
| 151 | 154 |
| 155 #define FOREACH_INT8X16_OPCODE(V) \ |
| 156 V(I8x16Splat) \ |
| 157 V(I8x16ExtractLane) \ |
| 158 V(I8x16ReplaceLane) \ |
| 159 V(I8x16Neg) \ |
| 160 V(I8x16Shl) \ |
| 161 V(I8x16ShrS) \ |
| 162 V(I8x16Add) \ |
| 163 V(I8x16AddSaturateS) \ |
| 164 V(I8x16Sub) \ |
| 165 V(I8x16SubSaturateS) \ |
| 166 V(I8x16Mul) \ |
| 167 V(I8x16MinS) \ |
| 168 V(I8x16MaxS) \ |
| 169 V(I8x16ShrU) \ |
| 170 V(I8x16AddSaturateU) \ |
| 171 V(I8x16SubSaturateU) \ |
| 172 V(I8x16MinU) \ |
| 173 V(I8x16MaxU) |
| 174 |
| 152 #define FOREACH_INT16X8_TO_SIMD1X8OPCODE(V) \ | 175 #define FOREACH_INT16X8_TO_SIMD1X8OPCODE(V) \ |
| 153 V(I16x8Eq) \ | 176 V(I16x8Eq) \ |
| 154 V(I16x8Ne) \ | 177 V(I16x8Ne) \ |
| 155 V(I16x8LtS) \ | 178 V(I16x8LtS) \ |
| 156 V(I16x8LeS) \ | 179 V(I16x8LeS) \ |
| 157 V(I16x8LtU) \ | 180 V(I16x8LtU) \ |
| 158 V(I16x8LeU) | 181 V(I16x8LeU) |
| 159 | 182 |
| 183 #define FOREACH_INT8X16_TO_SIMD1X16OPCODE(V) \ |
| 184 V(I8x16Eq) \ |
| 185 V(I8x16Ne) \ |
| 186 V(I8x16LtS) \ |
| 187 V(I8x16LeS) \ |
| 188 V(I8x16LtU) \ |
| 189 V(I8x16LeU) |
| 190 |
| 160 #define FOREACH_SIMD_TYPE_TO_MACHINE_TYPE(V) \ | 191 #define FOREACH_SIMD_TYPE_TO_MACHINE_TYPE(V) \ |
| 161 V(Float32x4, Float32) \ | 192 V(Float32x4, Float32) \ |
| 162 V(Int32x4, Int32) \ | 193 V(Int32x4, Int32) \ |
| 163 V(Int16x8, Int16) | 194 V(Int16x8, Int16) \ |
| 195 V(Int8x16, Int8) |
| 164 | 196 |
| 165 #define FOREACH_SIMD_TYPE_TO_MACHINE_REP(V) \ | 197 #define FOREACH_SIMD_TYPE_TO_MACHINE_REP(V) \ |
| 166 V(Float32x4, Float32) \ | 198 V(Float32x4, Float32) \ |
| 167 V(Int32x4, Word32) \ | 199 V(Int32x4, Word32) \ |
| 168 V(Int16x8, Word16) | 200 V(Int16x8, Word16) \ |
| 201 V(Int8x16, Word8) |
| 169 | 202 |
| 170 void SimdScalarLowering::SetLoweredType(Node* node, Node* output) { | 203 void SimdScalarLowering::SetLoweredType(Node* node, Node* output) { |
| 171 switch (node->opcode()) { | 204 switch (node->opcode()) { |
| 172 #define CASE_STMT(name) case IrOpcode::k##name: | 205 #define CASE_STMT(name) case IrOpcode::k##name: |
| 173 FOREACH_INT32X4_OPCODE(CASE_STMT) | 206 FOREACH_INT32X4_OPCODE(CASE_STMT) |
| 174 case IrOpcode::kReturn: | 207 case IrOpcode::kReturn: |
| 175 case IrOpcode::kParameter: | 208 case IrOpcode::kParameter: |
| 176 case IrOpcode::kCall: { | 209 case IrOpcode::kCall: { |
| 177 replacements_[node->id()].type = SimdType::kInt32x4; | 210 replacements_[node->id()].type = SimdType::kInt32x4; |
| 178 break; | 211 break; |
| 179 } | 212 } |
| 180 FOREACH_FLOAT32X4_OPCODE(CASE_STMT) { | 213 FOREACH_FLOAT32X4_OPCODE(CASE_STMT) { |
| 181 replacements_[node->id()].type = SimdType::kFloat32x4; | 214 replacements_[node->id()].type = SimdType::kFloat32x4; |
| 182 break; | 215 break; |
| 183 } | 216 } |
| 184 FOREACH_FLOAT32X4_TO_SIMD1X4OPCODE(CASE_STMT) | 217 FOREACH_FLOAT32X4_TO_SIMD1X4OPCODE(CASE_STMT) |
| 185 FOREACH_INT32X4_TO_SIMD1X4OPCODE(CASE_STMT) { | 218 FOREACH_INT32X4_TO_SIMD1X4OPCODE(CASE_STMT) { |
| 186 replacements_[node->id()].type = SimdType::kSimd1x4; | 219 replacements_[node->id()].type = SimdType::kSimd1x4; |
| 187 break; | 220 break; |
| 188 } | 221 } |
| 189 FOREACH_INT16X8_OPCODE(CASE_STMT) { | 222 FOREACH_INT16X8_OPCODE(CASE_STMT) { |
| 190 replacements_[node->id()].type = SimdType::kInt16x8; | 223 replacements_[node->id()].type = SimdType::kInt16x8; |
| 191 break; | 224 break; |
| 192 } | 225 } |
| 193 FOREACH_INT16X8_TO_SIMD1X8OPCODE(CASE_STMT) { | 226 FOREACH_INT16X8_TO_SIMD1X8OPCODE(CASE_STMT) { |
| 194 replacements_[node->id()].type = SimdType::kSimd1x8; | 227 replacements_[node->id()].type = SimdType::kSimd1x8; |
| 195 break; | 228 break; |
| 196 } | 229 } |
| 230 FOREACH_INT8X16_OPCODE(CASE_STMT) { |
| 231 replacements_[node->id()].type = SimdType::kInt8x16; |
| 232 break; |
| 233 } |
| 234 FOREACH_INT8X16_TO_SIMD1X16OPCODE(CASE_STMT) { |
| 235 replacements_[node->id()].type = SimdType::kSimd1x16; |
| 236 break; |
| 237 } |
| 197 default: { | 238 default: { |
| 198 switch (output->opcode()) { | 239 switch (output->opcode()) { |
| 199 FOREACH_FLOAT32X4_TO_SIMD1X4OPCODE(CASE_STMT) | 240 FOREACH_FLOAT32X4_TO_SIMD1X4OPCODE(CASE_STMT) |
| 200 case IrOpcode::kF32x4SConvertI32x4: | 241 case IrOpcode::kF32x4SConvertI32x4: |
| 201 case IrOpcode::kF32x4UConvertI32x4: { | 242 case IrOpcode::kF32x4UConvertI32x4: { |
| 202 replacements_[node->id()].type = SimdType::kInt32x4; | 243 replacements_[node->id()].type = SimdType::kInt32x4; |
| 203 break; | 244 break; |
| 204 } | 245 } |
| 205 FOREACH_INT32X4_TO_SIMD1X4OPCODE(CASE_STMT) | 246 FOREACH_INT32X4_TO_SIMD1X4OPCODE(CASE_STMT) |
| 206 case IrOpcode::kI32x4SConvertF32x4: | 247 case IrOpcode::kI32x4SConvertF32x4: |
| 207 case IrOpcode::kI32x4UConvertF32x4: { | 248 case IrOpcode::kI32x4UConvertF32x4: { |
| 208 replacements_[node->id()].type = SimdType::kFloat32x4; | 249 replacements_[node->id()].type = SimdType::kFloat32x4; |
| 209 break; | 250 break; |
| 210 } | 251 } |
| 211 case IrOpcode::kS32x4Select: { | 252 case IrOpcode::kS32x4Select: { |
| 212 replacements_[node->id()].type = SimdType::kSimd1x4; | 253 replacements_[node->id()].type = SimdType::kSimd1x4; |
| 213 break; | 254 break; |
| 214 } | 255 } |
| 215 FOREACH_INT16X8_TO_SIMD1X8OPCODE(CASE_STMT) { | 256 FOREACH_INT16X8_TO_SIMD1X8OPCODE(CASE_STMT) { |
| 216 replacements_[node->id()].type = SimdType::kInt16x8; | 257 replacements_[node->id()].type = SimdType::kInt16x8; |
| 217 break; | 258 break; |
| 218 } | 259 } |
| 260 FOREACH_INT8X16_TO_SIMD1X16OPCODE(CASE_STMT) { |
| 261 replacements_[node->id()].type = SimdType::kInt8x16; |
| 262 break; |
| 263 } |
| 219 case IrOpcode::kS16x8Select: { | 264 case IrOpcode::kS16x8Select: { |
| 220 replacements_[node->id()].type = SimdType::kSimd1x8; | 265 replacements_[node->id()].type = SimdType::kSimd1x8; |
| 221 break; | 266 break; |
| 222 } | 267 } |
| 223 default: { | 268 default: { |
| 224 replacements_[node->id()].type = replacements_[output->id()].type; | 269 replacements_[node->id()].type = replacements_[output->id()].type; |
| 225 } | 270 } |
| 226 } | 271 } |
| 227 } | 272 } |
| 228 #undef CASE_STMT | 273 #undef CASE_STMT |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 return result; | 308 return result; |
| 264 } | 309 } |
| 265 | 310 |
| 266 int SimdScalarLowering::NumLanes(SimdType type) { | 311 int SimdScalarLowering::NumLanes(SimdType type) { |
| 267 int num_lanes = 0; | 312 int num_lanes = 0; |
| 268 if (type == SimdType::kFloat32x4 || type == SimdType::kInt32x4 || | 313 if (type == SimdType::kFloat32x4 || type == SimdType::kInt32x4 || |
| 269 type == SimdType::kSimd1x4) { | 314 type == SimdType::kSimd1x4) { |
| 270 num_lanes = kNumLanes32; | 315 num_lanes = kNumLanes32; |
| 271 } else if (type == SimdType::kInt16x8 || type == SimdType::kSimd1x8) { | 316 } else if (type == SimdType::kInt16x8 || type == SimdType::kSimd1x8) { |
| 272 num_lanes = kNumLanes16; | 317 num_lanes = kNumLanes16; |
| 318 } else if (type == SimdType::kInt8x16 || type == SimdType::kSimd1x16) { |
| 319 num_lanes = kNumLanes8; |
| 273 } else { | 320 } else { |
| 274 UNREACHABLE(); | 321 UNREACHABLE(); |
| 275 } | 322 } |
| 276 return num_lanes; | 323 return num_lanes; |
| 277 } | 324 } |
| 278 | 325 |
| 279 constexpr int SimdScalarLowering::kLaneOffsets[]; | 326 constexpr int SimdScalarLowering::kLaneOffsets[]; |
| 280 | 327 |
| 281 void SimdScalarLowering::GetIndexNodes(Node* index, Node** new_indices, | 328 void SimdScalarLowering::GetIndexNodes(Node* index, Node** new_indices, |
| 282 SimdType type) { | 329 SimdType type) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 return graph()->NewNode(machine()->Word32Sar(), | 435 return graph()->NewNode(machine()->Word32Sar(), |
| 389 graph()->NewNode(machine()->Word32Shl(), input, | 436 graph()->NewNode(machine()->Word32Shl(), input, |
| 390 jsgraph_->Int32Constant(shift)), | 437 jsgraph_->Int32Constant(shift)), |
| 391 jsgraph_->Int32Constant(shift)); | 438 jsgraph_->Int32Constant(shift)); |
| 392 } | 439 } |
| 393 | 440 |
| 394 void SimdScalarLowering::LowerBinaryOpForSmallInt(Node* node, | 441 void SimdScalarLowering::LowerBinaryOpForSmallInt(Node* node, |
| 395 SimdType input_rep_type, | 442 SimdType input_rep_type, |
| 396 const Operator* op) { | 443 const Operator* op) { |
| 397 DCHECK(node->InputCount() == 2); | 444 DCHECK(node->InputCount() == 2); |
| 445 DCHECK(input_rep_type == SimdType::kInt16x8 || |
| 446 input_rep_type == SimdType::kInt8x16); |
| 398 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 447 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
| 399 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); | 448 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); |
| 400 int num_lanes = NumLanes(input_rep_type); | 449 int num_lanes = NumLanes(input_rep_type); |
| 401 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 450 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 451 int32_t shift_val = |
| 452 (input_rep_type == SimdType::kInt16x8) ? kShift16 : kShift8; |
| 402 for (int i = 0; i < num_lanes; ++i) { | 453 for (int i = 0; i < num_lanes; ++i) { |
| 403 rep_node[i] = | 454 rep_node[i] = FixUpperBits(graph()->NewNode(op, rep_left[i], rep_right[i]), |
| 404 FixUpperBits(graph()->NewNode(op, rep_left[i], rep_right[i]), kShift16); | 455 shift_val); |
| 405 } | 456 } |
| 406 ReplaceNode(node, rep_node, num_lanes); | 457 ReplaceNode(node, rep_node, num_lanes); |
| 407 } | 458 } |
| 408 | 459 |
| 409 Node* SimdScalarLowering::Mask(Node* input, int32_t mask) { | 460 Node* SimdScalarLowering::Mask(Node* input, int32_t mask) { |
| 410 return graph()->NewNode(machine()->Word32And(), input, | 461 return graph()->NewNode(machine()->Word32And(), input, |
| 411 jsgraph_->Int32Constant(mask)); | 462 jsgraph_->Int32Constant(mask)); |
| 412 } | 463 } |
| 413 | 464 |
| 414 void SimdScalarLowering::LowerSaturateBinaryOp(Node* node, | 465 void SimdScalarLowering::LowerSaturateBinaryOp(Node* node, |
| 415 SimdType input_rep_type, | 466 SimdType input_rep_type, |
| 416 const Operator* op, | 467 const Operator* op, |
| 417 bool is_signed) { | 468 bool is_signed) { |
| 418 DCHECK(node->InputCount() == 2); | 469 DCHECK(node->InputCount() == 2); |
| 470 DCHECK(input_rep_type == SimdType::kInt16x8 || |
| 471 input_rep_type == SimdType::kInt8x16); |
| 419 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 472 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
| 420 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); | 473 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); |
| 421 int32_t min = 0; | 474 int32_t min = 0; |
| 422 int32_t max = 0; | 475 int32_t max = 0; |
| 423 if (is_signed) { | 476 int32_t mask = 0; |
| 424 min = std::numeric_limits<int16_t>::min(); | 477 int32_t shift_val = 0; |
| 425 max = std::numeric_limits<int16_t>::max(); | 478 MachineRepresentation phi_rep; |
| 479 if (input_rep_type == SimdType::kInt16x8) { |
| 480 if (is_signed) { |
| 481 min = std::numeric_limits<int16_t>::min(); |
| 482 max = std::numeric_limits<int16_t>::max(); |
| 483 } else { |
| 484 min = std::numeric_limits<uint16_t>::min(); |
| 485 max = std::numeric_limits<uint16_t>::max(); |
| 486 } |
| 487 mask = kMask16; |
| 488 shift_val = kShift16; |
| 489 phi_rep = MachineRepresentation::kWord16; |
| 426 } else { | 490 } else { |
| 427 min = std::numeric_limits<uint16_t>::min(); | 491 if (is_signed) { |
| 428 max = std::numeric_limits<uint16_t>::max(); | 492 min = std::numeric_limits<int8_t>::min(); |
| 493 max = std::numeric_limits<int8_t>::max(); |
| 494 } else { |
| 495 min = std::numeric_limits<uint8_t>::min(); |
| 496 max = std::numeric_limits<uint8_t>::max(); |
| 497 } |
| 498 mask = kMask8; |
| 499 shift_val = kShift8; |
| 500 phi_rep = MachineRepresentation::kWord8; |
| 429 } | 501 } |
| 430 int num_lanes = NumLanes(input_rep_type); | 502 int num_lanes = NumLanes(input_rep_type); |
| 431 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 503 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 432 for (int i = 0; i < num_lanes; ++i) { | 504 for (int i = 0; i < num_lanes; ++i) { |
| 433 Node* op_result = nullptr; | 505 Node* op_result = nullptr; |
| 434 Node* left = is_signed ? rep_left[i] : Mask(rep_left[i], kMask16); | 506 Node* left = is_signed ? rep_left[i] : Mask(rep_left[i], mask); |
| 435 Node* right = is_signed ? rep_right[i] : Mask(rep_right[i], kMask16); | 507 Node* right = is_signed ? rep_right[i] : Mask(rep_right[i], mask); |
| 436 op_result = graph()->NewNode(op, left, right); | 508 op_result = graph()->NewNode(op, left, right); |
| 437 Diamond d_min(graph(), common(), | 509 Diamond d_min(graph(), common(), |
| 438 graph()->NewNode(machine()->Int32LessThan(), op_result, | 510 graph()->NewNode(machine()->Int32LessThan(), op_result, |
| 439 jsgraph_->Int32Constant(min))); | 511 jsgraph_->Int32Constant(min))); |
| 440 rep_node[i] = d_min.Phi(MachineRepresentation::kWord16, | 512 rep_node[i] = d_min.Phi(phi_rep, jsgraph_->Int32Constant(min), op_result); |
| 441 jsgraph_->Int32Constant(min), op_result); | |
| 442 Diamond d_max(graph(), common(), | 513 Diamond d_max(graph(), common(), |
| 443 graph()->NewNode(machine()->Int32LessThan(), | 514 graph()->NewNode(machine()->Int32LessThan(), |
| 444 jsgraph_->Int32Constant(max), rep_node[i])); | 515 jsgraph_->Int32Constant(max), rep_node[i])); |
| 445 rep_node[i] = d_max.Phi(MachineRepresentation::kWord16, | 516 rep_node[i] = d_max.Phi(phi_rep, jsgraph_->Int32Constant(max), rep_node[i]); |
| 446 jsgraph_->Int32Constant(max), rep_node[i]); | 517 rep_node[i] = |
| 447 rep_node[i] = is_signed ? rep_node[i] : FixUpperBits(rep_node[i], kShift16); | 518 is_signed ? rep_node[i] : FixUpperBits(rep_node[i], shift_val); |
| 448 } | 519 } |
| 449 ReplaceNode(node, rep_node, num_lanes); | 520 ReplaceNode(node, rep_node, num_lanes); |
| 450 } | 521 } |
| 451 | 522 |
| 452 void SimdScalarLowering::LowerUnaryOp(Node* node, SimdType input_rep_type, | 523 void SimdScalarLowering::LowerUnaryOp(Node* node, SimdType input_rep_type, |
| 453 const Operator* op) { | 524 const Operator* op) { |
| 454 DCHECK(node->InputCount() == 1); | 525 DCHECK(node->InputCount() == 1); |
| 455 Node** rep = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 526 Node** rep = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
| 456 int num_lanes = NumLanes(input_rep_type); | 527 int num_lanes = NumLanes(input_rep_type); |
| 457 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 528 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 458 for (int i = 0; i < num_lanes; ++i) { | 529 for (int i = 0; i < num_lanes; ++i) { |
| 459 rep_node[i] = graph()->NewNode(op, rep[i]); | 530 rep_node[i] = graph()->NewNode(op, rep[i]); |
| 460 } | 531 } |
| 461 ReplaceNode(node, rep_node, num_lanes); | 532 ReplaceNode(node, rep_node, num_lanes); |
| 462 } | 533 } |
| 463 | 534 |
| 464 void SimdScalarLowering::LowerIntMinMax(Node* node, const Operator* op, | 535 void SimdScalarLowering::LowerIntMinMax(Node* node, const Operator* op, |
| 465 bool is_max, SimdType type) { | 536 bool is_max, SimdType type) { |
| 466 DCHECK(node->InputCount() == 2); | 537 DCHECK(node->InputCount() == 2); |
| 467 Node** rep_left = GetReplacementsWithType(node->InputAt(0), type); | 538 Node** rep_left = GetReplacementsWithType(node->InputAt(0), type); |
| 468 Node** rep_right = GetReplacementsWithType(node->InputAt(1), type); | 539 Node** rep_right = GetReplacementsWithType(node->InputAt(1), type); |
| 469 int num_lanes = NumLanes(type); | 540 int num_lanes = NumLanes(type); |
| 470 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 541 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 471 MachineRepresentation rep = MachineRepresentation::kNone; | 542 MachineRepresentation rep = MachineRepresentation::kNone; |
| 472 if (type == SimdType::kInt32x4) { | 543 if (type == SimdType::kInt32x4) { |
| 473 rep = MachineRepresentation::kWord32; | 544 rep = MachineRepresentation::kWord32; |
| 474 } else if (type == SimdType::kInt16x8) { | 545 } else if (type == SimdType::kInt16x8) { |
| 475 rep = MachineRepresentation::kWord16; | 546 rep = MachineRepresentation::kWord16; |
| 547 } else if (type == SimdType::kInt8x16) { |
| 548 rep = MachineRepresentation::kWord8; |
| 476 } else { | 549 } else { |
| 477 UNREACHABLE(); | 550 UNREACHABLE(); |
| 478 } | 551 } |
| 479 for (int i = 0; i < num_lanes; ++i) { | 552 for (int i = 0; i < num_lanes; ++i) { |
| 480 Diamond d(graph(), common(), | 553 Diamond d(graph(), common(), |
| 481 graph()->NewNode(op, rep_left[i], rep_right[i])); | 554 graph()->NewNode(op, rep_left[i], rep_right[i])); |
| 482 if (is_max) { | 555 if (is_max) { |
| 483 rep_node[i] = d.Phi(rep, rep_right[i], rep_left[i]); | 556 rep_node[i] = d.Phi(rep, rep_right[i], rep_left[i]); |
| 484 } else { | 557 } else { |
| 485 rep_node[i] = d.Phi(rep, rep_left[i], rep_right[i]); | 558 rep_node[i] = d.Phi(rep, rep_left[i], rep_right[i]); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 void SimdScalarLowering::LowerShiftOp(Node* node, SimdType type) { | 627 void SimdScalarLowering::LowerShiftOp(Node* node, SimdType type) { |
| 555 DCHECK_EQ(1, node->InputCount()); | 628 DCHECK_EQ(1, node->InputCount()); |
| 556 int32_t shift_amount = OpParameter<int32_t>(node); | 629 int32_t shift_amount = OpParameter<int32_t>(node); |
| 557 Node* shift_node = graph()->NewNode(common()->Int32Constant(shift_amount)); | 630 Node* shift_node = graph()->NewNode(common()->Int32Constant(shift_amount)); |
| 558 Node** rep = GetReplacementsWithType(node->InputAt(0), type); | 631 Node** rep = GetReplacementsWithType(node->InputAt(0), type); |
| 559 int num_lanes = NumLanes(type); | 632 int num_lanes = NumLanes(type); |
| 560 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 633 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 561 for (int i = 0; i < num_lanes; ++i) { | 634 for (int i = 0; i < num_lanes; ++i) { |
| 562 rep_node[i] = rep[i]; | 635 rep_node[i] = rep[i]; |
| 563 switch (node->opcode()) { | 636 switch (node->opcode()) { |
| 637 case IrOpcode::kI8x16ShrU: |
| 638 rep_node[i] = Mask(rep_node[i], kMask8); |
| 639 rep_node[i] = |
| 640 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); |
| 641 break; |
| 564 case IrOpcode::kI16x8ShrU: | 642 case IrOpcode::kI16x8ShrU: |
| 565 rep_node[i] = Mask(rep_node[i], kMask16); // Fall through. | 643 rep_node[i] = Mask(rep_node[i], kMask16); // Fall through. |
| 566 case IrOpcode::kI32x4ShrU: | 644 case IrOpcode::kI32x4ShrU: |
| 567 rep_node[i] = | 645 rep_node[i] = |
| 568 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); | 646 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); |
| 569 break; | 647 break; |
| 570 case IrOpcode::kI32x4Shl: | 648 case IrOpcode::kI32x4Shl: |
| 571 rep_node[i] = | 649 rep_node[i] = |
| 572 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); | 650 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); |
| 573 break; | 651 break; |
| 574 case IrOpcode::kI16x8Shl: | 652 case IrOpcode::kI16x8Shl: |
| 575 rep_node[i] = | 653 rep_node[i] = |
| 576 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); | 654 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); |
| 577 rep_node[i] = FixUpperBits(rep_node[i], kShift16); | 655 rep_node[i] = FixUpperBits(rep_node[i], kShift16); |
| 578 break; | 656 break; |
| 657 case IrOpcode::kI8x16Shl: |
| 658 rep_node[i] = |
| 659 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); |
| 660 rep_node[i] = FixUpperBits(rep_node[i], kShift8); |
| 661 break; |
| 579 case IrOpcode::kI32x4ShrS: | 662 case IrOpcode::kI32x4ShrS: |
| 580 case IrOpcode::kI16x8ShrS: | 663 case IrOpcode::kI16x8ShrS: |
| 664 case IrOpcode::kI8x16ShrS: |
| 581 rep_node[i] = | 665 rep_node[i] = |
| 582 graph()->NewNode(machine()->Word32Sar(), rep_node[i], shift_node); | 666 graph()->NewNode(machine()->Word32Sar(), rep_node[i], shift_node); |
| 583 break; | 667 break; |
| 584 default: | 668 default: |
| 585 UNREACHABLE(); | 669 UNREACHABLE(); |
| 586 } | 670 } |
| 587 } | 671 } |
| 588 ReplaceNode(node, rep_node, num_lanes); | 672 ReplaceNode(node, rep_node, num_lanes); |
| 589 } | 673 } |
| 590 | 674 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 LowerBinaryOp(node, rep_type, machine()->instruction()); \ | 863 LowerBinaryOp(node, rep_type, machine()->instruction()); \ |
| 780 break; \ | 864 break; \ |
| 781 } | 865 } |
| 782 I32X4_BINOP_CASE(kI32x4Add, Int32Add) | 866 I32X4_BINOP_CASE(kI32x4Add, Int32Add) |
| 783 I32X4_BINOP_CASE(kI32x4Sub, Int32Sub) | 867 I32X4_BINOP_CASE(kI32x4Sub, Int32Sub) |
| 784 I32X4_BINOP_CASE(kI32x4Mul, Int32Mul) | 868 I32X4_BINOP_CASE(kI32x4Mul, Int32Mul) |
| 785 I32X4_BINOP_CASE(kS128And, Word32And) | 869 I32X4_BINOP_CASE(kS128And, Word32And) |
| 786 I32X4_BINOP_CASE(kS128Or, Word32Or) | 870 I32X4_BINOP_CASE(kS128Or, Word32Or) |
| 787 I32X4_BINOP_CASE(kS128Xor, Word32Xor) | 871 I32X4_BINOP_CASE(kS128Xor, Word32Xor) |
| 788 #undef I32X4_BINOP_CASE | 872 #undef I32X4_BINOP_CASE |
| 789 case IrOpcode::kI16x8Add: { | 873 case IrOpcode::kI16x8Add: |
| 874 case IrOpcode::kI8x16Add: { |
| 790 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Add()); | 875 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Add()); |
| 791 break; | 876 break; |
| 792 } | 877 } |
| 793 case IrOpcode::kI16x8Sub: { | 878 case IrOpcode::kI16x8Sub: |
| 879 case IrOpcode::kI8x16Sub: { |
| 794 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Sub()); | 880 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Sub()); |
| 795 break; | 881 break; |
| 796 } | 882 } |
| 797 case IrOpcode::kI16x8Mul: { | 883 case IrOpcode::kI16x8Mul: |
| 884 case IrOpcode::kI8x16Mul: { |
| 798 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Mul()); | 885 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Mul()); |
| 799 break; | 886 break; |
| 800 } | 887 } |
| 801 case IrOpcode::kI16x8AddSaturateS: { | 888 case IrOpcode::kI16x8AddSaturateS: |
| 889 case IrOpcode::kI8x16AddSaturateS: { |
| 802 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), true); | 890 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), true); |
| 803 break; | 891 break; |
| 804 } | 892 } |
| 805 case IrOpcode::kI16x8SubSaturateS: { | 893 case IrOpcode::kI16x8SubSaturateS: |
| 894 case IrOpcode::kI8x16SubSaturateS: { |
| 806 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), true); | 895 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), true); |
| 807 break; | 896 break; |
| 808 } | 897 } |
| 809 case IrOpcode::kI16x8AddSaturateU: { | 898 case IrOpcode::kI16x8AddSaturateU: |
| 899 case IrOpcode::kI8x16AddSaturateU: { |
| 810 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), false); | 900 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), false); |
| 811 break; | 901 break; |
| 812 } | 902 } |
| 813 case IrOpcode::kI16x8SubSaturateU: { | 903 case IrOpcode::kI16x8SubSaturateU: |
| 904 case IrOpcode::kI8x16SubSaturateU: { |
| 814 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), false); | 905 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), false); |
| 815 break; | 906 break; |
| 816 } | 907 } |
| 817 case IrOpcode::kI32x4MaxS: | 908 case IrOpcode::kI32x4MaxS: |
| 818 case IrOpcode::kI16x8MaxS: { | 909 case IrOpcode::kI16x8MaxS: |
| 910 case IrOpcode::kI8x16MaxS: { |
| 819 LowerIntMinMax(node, machine()->Int32LessThan(), true, rep_type); | 911 LowerIntMinMax(node, machine()->Int32LessThan(), true, rep_type); |
| 820 break; | 912 break; |
| 821 } | 913 } |
| 822 case IrOpcode::kI32x4MinS: | 914 case IrOpcode::kI32x4MinS: |
| 823 case IrOpcode::kI16x8MinS: { | 915 case IrOpcode::kI16x8MinS: |
| 916 case IrOpcode::kI8x16MinS: { |
| 824 LowerIntMinMax(node, machine()->Int32LessThan(), false, rep_type); | 917 LowerIntMinMax(node, machine()->Int32LessThan(), false, rep_type); |
| 825 break; | 918 break; |
| 826 } | 919 } |
| 827 case IrOpcode::kI32x4MaxU: | 920 case IrOpcode::kI32x4MaxU: |
| 828 case IrOpcode::kI16x8MaxU: { | 921 case IrOpcode::kI16x8MaxU: |
| 922 case IrOpcode::kI8x16MaxU: { |
| 829 LowerIntMinMax(node, machine()->Uint32LessThan(), true, rep_type); | 923 LowerIntMinMax(node, machine()->Uint32LessThan(), true, rep_type); |
| 830 break; | 924 break; |
| 831 } | 925 } |
| 832 case IrOpcode::kI32x4MinU: | 926 case IrOpcode::kI32x4MinU: |
| 833 case IrOpcode::kI16x8MinU: { | 927 case IrOpcode::kI16x8MinU: |
| 928 case IrOpcode::kI8x16MinU: { |
| 834 LowerIntMinMax(node, machine()->Uint32LessThan(), false, rep_type); | 929 LowerIntMinMax(node, machine()->Uint32LessThan(), false, rep_type); |
| 835 break; | 930 break; |
| 836 } | 931 } |
| 837 case IrOpcode::kI32x4Neg: | 932 case IrOpcode::kI32x4Neg: |
| 838 case IrOpcode::kI16x8Neg: { | 933 case IrOpcode::kI16x8Neg: |
| 934 case IrOpcode::kI8x16Neg: { |
| 839 DCHECK(node->InputCount() == 1); | 935 DCHECK(node->InputCount() == 1); |
| 840 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); | 936 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); |
| 841 int num_lanes = NumLanes(rep_type); | 937 int num_lanes = NumLanes(rep_type); |
| 842 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 938 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 843 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 939 Node* zero = graph()->NewNode(common()->Int32Constant(0)); |
| 844 for (int i = 0; i < num_lanes; ++i) { | 940 for (int i = 0; i < num_lanes; ++i) { |
| 845 rep_node[i] = graph()->NewNode(machine()->Int32Sub(), zero, rep[i]); | 941 rep_node[i] = graph()->NewNode(machine()->Int32Sub(), zero, rep[i]); |
| 846 if (node->opcode() == IrOpcode::kI16x8Neg) { | 942 if (node->opcode() == IrOpcode::kI16x8Neg) { |
| 847 rep_node[i] = FixUpperBits(rep_node[i], kShift16); | 943 rep_node[i] = FixUpperBits(rep_node[i], kShift16); |
| 944 } else if (node->opcode() == IrOpcode::kI8x16Neg) { |
| 945 rep_node[i] = FixUpperBits(rep_node[i], kShift8); |
| 848 } | 946 } |
| 849 } | 947 } |
| 850 ReplaceNode(node, rep_node, num_lanes); | 948 ReplaceNode(node, rep_node, num_lanes); |
| 851 break; | 949 break; |
| 852 } | 950 } |
| 853 case IrOpcode::kS128Not: { | 951 case IrOpcode::kS128Not: { |
| 854 DCHECK(node->InputCount() == 1); | 952 DCHECK(node->InputCount() == 1); |
| 855 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); | 953 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); |
| 856 Node* rep_node[kNumLanes32]; | 954 Node* rep_node[kNumLanes32]; |
| 857 Node* mask = graph()->NewNode(common()->Int32Constant(0xffffffff)); | 955 Node* mask = graph()->NewNode(common()->Int32Constant(0xffffffff)); |
| 858 for (int i = 0; i < kNumLanes32; ++i) { | 956 for (int i = 0; i < kNumLanes32; ++i) { |
| 859 rep_node[i] = graph()->NewNode(machine()->Word32Xor(), rep[i], mask); | 957 rep_node[i] = graph()->NewNode(machine()->Word32Xor(), rep[i], mask); |
| 860 } | 958 } |
| 861 ReplaceNode(node, rep_node, kNumLanes32); | 959 ReplaceNode(node, rep_node, kNumLanes32); |
| 862 break; | 960 break; |
| 863 } | 961 } |
| 864 case IrOpcode::kI32x4SConvertF32x4: { | 962 case IrOpcode::kI32x4SConvertF32x4: { |
| 865 LowerConvertFromFloat(node, true); | 963 LowerConvertFromFloat(node, true); |
| 866 break; | 964 break; |
| 867 } | 965 } |
| 868 case IrOpcode::kI32x4UConvertF32x4: { | 966 case IrOpcode::kI32x4UConvertF32x4: { |
| 869 LowerConvertFromFloat(node, false); | 967 LowerConvertFromFloat(node, false); |
| 870 break; | 968 break; |
| 871 } | 969 } |
| 872 case IrOpcode::kI32x4Shl: | 970 case IrOpcode::kI32x4Shl: |
| 873 case IrOpcode::kI16x8Shl: | 971 case IrOpcode::kI16x8Shl: |
| 972 case IrOpcode::kI8x16Shl: |
| 874 case IrOpcode::kI32x4ShrS: | 973 case IrOpcode::kI32x4ShrS: |
| 875 case IrOpcode::kI16x8ShrS: | 974 case IrOpcode::kI16x8ShrS: |
| 975 case IrOpcode::kI8x16ShrS: |
| 876 case IrOpcode::kI32x4ShrU: | 976 case IrOpcode::kI32x4ShrU: |
| 877 case IrOpcode::kI16x8ShrU: { | 977 case IrOpcode::kI16x8ShrU: |
| 978 case IrOpcode::kI8x16ShrU: { |
| 878 LowerShiftOp(node, rep_type); | 979 LowerShiftOp(node, rep_type); |
| 879 break; | 980 break; |
| 880 } | 981 } |
| 881 #define F32X4_BINOP_CASE(name) \ | 982 #define F32X4_BINOP_CASE(name) \ |
| 882 case IrOpcode::kF32x4##name: { \ | 983 case IrOpcode::kF32x4##name: { \ |
| 883 LowerBinaryOp(node, rep_type, machine()->Float32##name()); \ | 984 LowerBinaryOp(node, rep_type, machine()->Float32##name()); \ |
| 884 break; \ | 985 break; \ |
| 885 } | 986 } |
| 886 F32X4_BINOP_CASE(Add) | 987 F32X4_BINOP_CASE(Add) |
| 887 F32X4_BINOP_CASE(Sub) | 988 F32X4_BINOP_CASE(Sub) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 900 case IrOpcode::kF32x4SConvertI32x4: { | 1001 case IrOpcode::kF32x4SConvertI32x4: { |
| 901 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundInt32ToFloat32()); | 1002 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundInt32ToFloat32()); |
| 902 break; | 1003 break; |
| 903 } | 1004 } |
| 904 case IrOpcode::kF32x4UConvertI32x4: { | 1005 case IrOpcode::kF32x4UConvertI32x4: { |
| 905 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundUint32ToFloat32()); | 1006 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundUint32ToFloat32()); |
| 906 break; | 1007 break; |
| 907 } | 1008 } |
| 908 case IrOpcode::kI32x4Splat: | 1009 case IrOpcode::kI32x4Splat: |
| 909 case IrOpcode::kF32x4Splat: | 1010 case IrOpcode::kF32x4Splat: |
| 910 case IrOpcode::kI16x8Splat: { | 1011 case IrOpcode::kI16x8Splat: |
| 1012 case IrOpcode::kI8x16Splat: { |
| 911 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1013 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 912 for (int i = 0; i < num_lanes; ++i) { | 1014 for (int i = 0; i < num_lanes; ++i) { |
| 913 if (HasReplacement(0, node->InputAt(0))) { | 1015 if (HasReplacement(0, node->InputAt(0))) { |
| 914 rep_node[i] = GetReplacements(node->InputAt(0))[0]; | 1016 rep_node[i] = GetReplacements(node->InputAt(0))[0]; |
| 915 } else { | 1017 } else { |
| 916 rep_node[i] = node->InputAt(0); | 1018 rep_node[i] = node->InputAt(0); |
| 917 } | 1019 } |
| 918 } | 1020 } |
| 919 ReplaceNode(node, rep_node, num_lanes); | 1021 ReplaceNode(node, rep_node, num_lanes); |
| 920 break; | 1022 break; |
| 921 } | 1023 } |
| 922 case IrOpcode::kI32x4ExtractLane: | 1024 case IrOpcode::kI32x4ExtractLane: |
| 923 case IrOpcode::kF32x4ExtractLane: | 1025 case IrOpcode::kF32x4ExtractLane: |
| 924 case IrOpcode::kI16x8ExtractLane: { | 1026 case IrOpcode::kI16x8ExtractLane: |
| 1027 case IrOpcode::kI8x16ExtractLane: { |
| 925 int32_t lane = OpParameter<int32_t>(node); | 1028 int32_t lane = OpParameter<int32_t>(node); |
| 926 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1029 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 927 rep_node[0] = GetReplacementsWithType(node->InputAt(0), rep_type)[lane]; | 1030 rep_node[0] = GetReplacementsWithType(node->InputAt(0), rep_type)[lane]; |
| 928 for (int i = 1; i < num_lanes; ++i) { | 1031 for (int i = 1; i < num_lanes; ++i) { |
| 929 rep_node[i] = nullptr; | 1032 rep_node[i] = nullptr; |
| 930 } | 1033 } |
| 931 ReplaceNode(node, rep_node, num_lanes); | 1034 ReplaceNode(node, rep_node, num_lanes); |
| 932 break; | 1035 break; |
| 933 } | 1036 } |
| 934 case IrOpcode::kI32x4ReplaceLane: | 1037 case IrOpcode::kI32x4ReplaceLane: |
| 935 case IrOpcode::kF32x4ReplaceLane: | 1038 case IrOpcode::kF32x4ReplaceLane: |
| 936 case IrOpcode::kI16x8ReplaceLane: { | 1039 case IrOpcode::kI16x8ReplaceLane: |
| 1040 case IrOpcode::kI8x16ReplaceLane: { |
| 937 DCHECK_EQ(2, node->InputCount()); | 1041 DCHECK_EQ(2, node->InputCount()); |
| 938 Node* repNode = node->InputAt(1); | 1042 Node* repNode = node->InputAt(1); |
| 939 int32_t lane = OpParameter<int32_t>(node); | 1043 int32_t lane = OpParameter<int32_t>(node); |
| 940 Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type); | 1044 Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type); |
| 941 if (HasReplacement(0, repNode)) { | 1045 if (HasReplacement(0, repNode)) { |
| 942 rep_node[lane] = GetReplacements(repNode)[0]; | 1046 rep_node[lane] = GetReplacements(repNode)[0]; |
| 943 } else { | 1047 } else { |
| 944 rep_node[lane] = repNode; | 1048 rep_node[lane] = repNode; |
| 945 } | 1049 } |
| 946 ReplaceNode(node, rep_node, num_lanes); | 1050 ReplaceNode(node, rep_node, num_lanes); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 967 COMPARISON_CASE(Int32x4, kI32x4GeU, Uint32LessThanOrEqual, true) | 1071 COMPARISON_CASE(Int32x4, kI32x4GeU, Uint32LessThanOrEqual, true) |
| 968 COMPARISON_CASE(Int16x8, kI16x8Eq, Word32Equal, false) | 1072 COMPARISON_CASE(Int16x8, kI16x8Eq, Word32Equal, false) |
| 969 COMPARISON_CASE(Int16x8, kI16x8LtS, Int32LessThan, false) | 1073 COMPARISON_CASE(Int16x8, kI16x8LtS, Int32LessThan, false) |
| 970 COMPARISON_CASE(Int16x8, kI16x8LeS, Int32LessThanOrEqual, false) | 1074 COMPARISON_CASE(Int16x8, kI16x8LeS, Int32LessThanOrEqual, false) |
| 971 COMPARISON_CASE(Int16x8, kI16x8GtS, Int32LessThan, true) | 1075 COMPARISON_CASE(Int16x8, kI16x8GtS, Int32LessThan, true) |
| 972 COMPARISON_CASE(Int16x8, kI16x8GeS, Int32LessThanOrEqual, true) | 1076 COMPARISON_CASE(Int16x8, kI16x8GeS, Int32LessThanOrEqual, true) |
| 973 COMPARISON_CASE(Int16x8, kI16x8LtU, Uint32LessThan, false) | 1077 COMPARISON_CASE(Int16x8, kI16x8LtU, Uint32LessThan, false) |
| 974 COMPARISON_CASE(Int16x8, kI16x8LeU, Uint32LessThanOrEqual, false) | 1078 COMPARISON_CASE(Int16x8, kI16x8LeU, Uint32LessThanOrEqual, false) |
| 975 COMPARISON_CASE(Int16x8, kI16x8GtU, Uint32LessThan, true) | 1079 COMPARISON_CASE(Int16x8, kI16x8GtU, Uint32LessThan, true) |
| 976 COMPARISON_CASE(Int16x8, kI16x8GeU, Uint32LessThanOrEqual, true) | 1080 COMPARISON_CASE(Int16x8, kI16x8GeU, Uint32LessThanOrEqual, true) |
| 1081 COMPARISON_CASE(Int8x16, kI8x16Eq, Word32Equal, false) |
| 1082 COMPARISON_CASE(Int8x16, kI8x16LtS, Int32LessThan, false) |
| 1083 COMPARISON_CASE(Int8x16, kI8x16LeS, Int32LessThanOrEqual, false) |
| 1084 COMPARISON_CASE(Int8x16, kI8x16GtS, Int32LessThan, true) |
| 1085 COMPARISON_CASE(Int8x16, kI8x16GeS, Int32LessThanOrEqual, true) |
| 1086 COMPARISON_CASE(Int8x16, kI8x16LtU, Uint32LessThan, false) |
| 1087 COMPARISON_CASE(Int8x16, kI8x16LeU, Uint32LessThanOrEqual, false) |
| 1088 COMPARISON_CASE(Int8x16, kI8x16GtU, Uint32LessThan, true) |
| 1089 COMPARISON_CASE(Int8x16, kI8x16GeU, Uint32LessThanOrEqual, true) |
| 977 #undef COMPARISON_CASE | 1090 #undef COMPARISON_CASE |
| 978 case IrOpcode::kF32x4Ne: { | 1091 case IrOpcode::kF32x4Ne: { |
| 979 LowerNotEqual(node, SimdType::kFloat32x4, machine()->Float32Equal()); | 1092 LowerNotEqual(node, SimdType::kFloat32x4, machine()->Float32Equal()); |
| 980 break; | 1093 break; |
| 981 } | 1094 } |
| 982 case IrOpcode::kI32x4Ne: { | 1095 case IrOpcode::kI32x4Ne: { |
| 983 LowerNotEqual(node, SimdType::kInt32x4, machine()->Word32Equal()); | 1096 LowerNotEqual(node, SimdType::kInt32x4, machine()->Word32Equal()); |
| 984 break; | 1097 break; |
| 985 } | 1098 } |
| 986 case IrOpcode::kI16x8Ne: { | 1099 case IrOpcode::kI16x8Ne: { |
| 987 LowerNotEqual(node, SimdType::kInt16x8, machine()->Word32Equal()); | 1100 LowerNotEqual(node, SimdType::kInt16x8, machine()->Word32Equal()); |
| 988 break; | 1101 break; |
| 989 } | 1102 } |
| 1103 case IrOpcode::kI8x16Ne: { |
| 1104 LowerNotEqual(node, SimdType::kInt8x16, machine()->Word32Equal()); |
| 1105 break; |
| 1106 } |
| 990 case IrOpcode::kS32x4Select: | 1107 case IrOpcode::kS32x4Select: |
| 991 case IrOpcode::kS16x8Select: { | 1108 case IrOpcode::kS16x8Select: |
| 1109 case IrOpcode::kS8x16Select: { |
| 992 DCHECK(node->InputCount() == 3); | 1110 DCHECK(node->InputCount() == 3); |
| 993 DCHECK(ReplacementType(node->InputAt(0)) == SimdType::kSimd1x4 || | 1111 DCHECK(ReplacementType(node->InputAt(0)) == SimdType::kSimd1x4 || |
| 994 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x8); | 1112 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x8 || |
| 1113 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x16); |
| 995 Node** boolean_input = GetReplacements(node->InputAt(0)); | 1114 Node** boolean_input = GetReplacements(node->InputAt(0)); |
| 996 Node** rep_left = GetReplacementsWithType(node->InputAt(1), rep_type); | 1115 Node** rep_left = GetReplacementsWithType(node->InputAt(1), rep_type); |
| 997 Node** rep_right = GetReplacementsWithType(node->InputAt(2), rep_type); | 1116 Node** rep_right = GetReplacementsWithType(node->InputAt(2), rep_type); |
| 998 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1117 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
| 999 for (int i = 0; i < num_lanes; ++i) { | 1118 for (int i = 0; i < num_lanes; ++i) { |
| 1000 Diamond d(graph(), common(), | 1119 Diamond d(graph(), common(), |
| 1001 graph()->NewNode(machine()->Word32Equal(), boolean_input[i], | 1120 graph()->NewNode(machine()->Word32Equal(), boolean_input[i], |
| 1002 jsgraph_->Int32Constant(0))); | 1121 jsgraph_->Int32Constant(0))); |
| 1003 #define SELECT_CASE(sType, mType) \ | 1122 #define SELECT_CASE(sType, mType) \ |
| 1004 case SimdType::k##sType: \ | 1123 case SimdType::k##sType: \ |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 UNREACHABLE(); | 1277 UNREACHABLE(); |
| 1159 } | 1278 } |
| 1160 #undef PHI_CASE | 1279 #undef PHI_CASE |
| 1161 } | 1280 } |
| 1162 ReplaceNode(phi, rep_nodes, num_lanes); | 1281 ReplaceNode(phi, rep_nodes, num_lanes); |
| 1163 } | 1282 } |
| 1164 } | 1283 } |
| 1165 } // namespace compiler | 1284 } // namespace compiler |
| 1166 } // namespace internal | 1285 } // namespace internal |
| 1167 } // namespace v8 | 1286 } // namespace v8 |
| OLD | NEW |