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 kShift24 = 24; | |
aseemgarg
2017/05/09 20:01:24
rename to kShift8? I named these by type rather th
dusan.simicic
2017/05/10 09:50:05
Done.
| |
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 void SimdScalarLowering::GetIndexNodes(Node* index, Node** new_indices, | 326 void SimdScalarLowering::GetIndexNodes(Node* index, Node** new_indices, |
280 SimdType type) { | 327 SimdType type) { |
281 new_indices[0] = index; | 328 new_indices[0] = index; |
282 int num_lanes = NumLanes(type); | 329 int num_lanes = NumLanes(type); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 return graph()->NewNode(machine()->Word32Sar(), | 430 return graph()->NewNode(machine()->Word32Sar(), |
384 graph()->NewNode(machine()->Word32Shl(), input, | 431 graph()->NewNode(machine()->Word32Shl(), input, |
385 jsgraph_->Int32Constant(shift)), | 432 jsgraph_->Int32Constant(shift)), |
386 jsgraph_->Int32Constant(shift)); | 433 jsgraph_->Int32Constant(shift)); |
387 } | 434 } |
388 | 435 |
389 void SimdScalarLowering::LowerBinaryOpForSmallInt(Node* node, | 436 void SimdScalarLowering::LowerBinaryOpForSmallInt(Node* node, |
390 SimdType input_rep_type, | 437 SimdType input_rep_type, |
391 const Operator* op) { | 438 const Operator* op) { |
392 DCHECK(node->InputCount() == 2); | 439 DCHECK(node->InputCount() == 2); |
440 DCHECK(input_rep_type == SimdType::kInt16x8 || | |
441 input_rep_type == SimdType::kInt8x16); | |
393 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 442 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
394 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); | 443 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); |
395 int num_lanes = NumLanes(input_rep_type); | 444 int num_lanes = NumLanes(input_rep_type); |
396 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 445 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
446 int32_t shift_val = | |
447 (input_rep_type == SimdType::kInt16x8) ? kShift16 : kShift24; | |
397 for (int i = 0; i < num_lanes; ++i) { | 448 for (int i = 0; i < num_lanes; ++i) { |
398 rep_node[i] = | 449 rep_node[i] = FixUpperBits(graph()->NewNode(op, rep_left[i], rep_right[i]), |
399 FixUpperBits(graph()->NewNode(op, rep_left[i], rep_right[i]), kShift16); | 450 shift_val); |
400 } | 451 } |
401 ReplaceNode(node, rep_node, num_lanes); | 452 ReplaceNode(node, rep_node, num_lanes); |
402 } | 453 } |
403 | 454 |
404 Node* SimdScalarLowering::Mask(Node* input, int32_t mask) { | 455 Node* SimdScalarLowering::Mask(Node* input, int32_t mask) { |
405 return graph()->NewNode(machine()->Word32And(), input, | 456 return graph()->NewNode(machine()->Word32And(), input, |
406 jsgraph_->Int32Constant(mask)); | 457 jsgraph_->Int32Constant(mask)); |
407 } | 458 } |
408 | 459 |
409 void SimdScalarLowering::LowerSaturateBinaryOp(Node* node, | 460 void SimdScalarLowering::LowerSaturateBinaryOp(Node* node, |
410 SimdType input_rep_type, | 461 SimdType input_rep_type, |
411 const Operator* op, | 462 const Operator* op, |
412 bool is_signed) { | 463 bool is_signed) { |
413 DCHECK(node->InputCount() == 2); | 464 DCHECK(node->InputCount() == 2); |
465 DCHECK(input_rep_type == SimdType::kInt16x8 || | |
466 input_rep_type == SimdType::kInt8x16); | |
414 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 467 Node** rep_left = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
415 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); | 468 Node** rep_right = GetReplacementsWithType(node->InputAt(1), input_rep_type); |
416 int32_t min = 0; | 469 int32_t min = 0; |
417 int32_t max = 0; | 470 int32_t max = 0; |
418 if (is_signed) { | 471 int32_t mask = 0; |
419 min = std::numeric_limits<int16_t>::min(); | 472 int32_t shift_val = 0; |
420 max = std::numeric_limits<int16_t>::max(); | 473 MachineRepresentation phi_mach_rep; |
aseemgarg
2017/05/09 20:01:24
rename to phi_rep?
dusan.simicic
2017/05/10 09:50:06
Done.
| |
474 if (input_rep_type == SimdType::kInt16x8) { | |
475 if (is_signed) { | |
476 min = std::numeric_limits<int16_t>::min(); | |
477 max = std::numeric_limits<int16_t>::max(); | |
478 } else { | |
479 min = std::numeric_limits<uint16_t>::min(); | |
480 max = std::numeric_limits<uint16_t>::max(); | |
481 } | |
482 mask = kMask16; | |
483 shift_val = kShift16; | |
484 phi_mach_rep = MachineRepresentation::kWord16; | |
421 } else { | 485 } else { |
422 min = std::numeric_limits<uint16_t>::min(); | 486 if (is_signed) { |
423 max = std::numeric_limits<uint16_t>::max(); | 487 min = std::numeric_limits<int8_t>::min(); |
488 max = std::numeric_limits<int8_t>::max(); | |
489 } else { | |
490 min = std::numeric_limits<uint8_t>::min(); | |
491 max = std::numeric_limits<uint8_t>::max(); | |
492 } | |
493 mask = kMask8; | |
494 shift_val = kShift24; | |
495 phi_mach_rep = MachineRepresentation::kWord8; | |
424 } | 496 } |
425 int num_lanes = NumLanes(input_rep_type); | 497 int num_lanes = NumLanes(input_rep_type); |
426 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 498 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
427 for (int i = 0; i < num_lanes; ++i) { | 499 for (int i = 0; i < num_lanes; ++i) { |
428 Node* op_result = nullptr; | 500 Node* op_result = nullptr; |
429 Node* left = is_signed ? rep_left[i] : Mask(rep_left[i], kMask16); | 501 Node* left = is_signed ? rep_left[i] : Mask(rep_left[i], mask); |
430 Node* right = is_signed ? rep_right[i] : Mask(rep_right[i], kMask16); | 502 Node* right = is_signed ? rep_right[i] : Mask(rep_right[i], mask); |
431 op_result = graph()->NewNode(op, left, right); | 503 op_result = graph()->NewNode(op, left, right); |
432 Diamond d_min(graph(), common(), | 504 Diamond d_min(graph(), common(), |
433 graph()->NewNode(machine()->Int32LessThan(), op_result, | 505 graph()->NewNode(machine()->Int32LessThan(), op_result, |
434 jsgraph_->Int32Constant(min))); | 506 jsgraph_->Int32Constant(min))); |
435 rep_node[i] = d_min.Phi(MachineRepresentation::kWord16, | 507 rep_node[i] = |
436 jsgraph_->Int32Constant(min), op_result); | 508 d_min.Phi(phi_mach_rep, jsgraph_->Int32Constant(min), op_result); |
437 Diamond d_max(graph(), common(), | 509 Diamond d_max(graph(), common(), |
438 graph()->NewNode(machine()->Int32LessThan(), | 510 graph()->NewNode(machine()->Int32LessThan(), |
439 jsgraph_->Int32Constant(max), rep_node[i])); | 511 jsgraph_->Int32Constant(max), rep_node[i])); |
440 rep_node[i] = d_max.Phi(MachineRepresentation::kWord16, | 512 rep_node[i] = |
441 jsgraph_->Int32Constant(max), rep_node[i]); | 513 d_max.Phi(phi_mach_rep, jsgraph_->Int32Constant(max), rep_node[i]); |
442 rep_node[i] = is_signed ? rep_node[i] : FixUpperBits(rep_node[i], kShift16); | 514 rep_node[i] = |
515 is_signed ? rep_node[i] : FixUpperBits(rep_node[i], shift_val); | |
443 } | 516 } |
444 ReplaceNode(node, rep_node, num_lanes); | 517 ReplaceNode(node, rep_node, num_lanes); |
445 } | 518 } |
446 | 519 |
447 void SimdScalarLowering::LowerUnaryOp(Node* node, SimdType input_rep_type, | 520 void SimdScalarLowering::LowerUnaryOp(Node* node, SimdType input_rep_type, |
448 const Operator* op) { | 521 const Operator* op) { |
449 DCHECK(node->InputCount() == 1); | 522 DCHECK(node->InputCount() == 1); |
450 Node** rep = GetReplacementsWithType(node->InputAt(0), input_rep_type); | 523 Node** rep = GetReplacementsWithType(node->InputAt(0), input_rep_type); |
451 int num_lanes = NumLanes(input_rep_type); | 524 int num_lanes = NumLanes(input_rep_type); |
452 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 525 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
453 for (int i = 0; i < num_lanes; ++i) { | 526 for (int i = 0; i < num_lanes; ++i) { |
454 rep_node[i] = graph()->NewNode(op, rep[i]); | 527 rep_node[i] = graph()->NewNode(op, rep[i]); |
455 } | 528 } |
456 ReplaceNode(node, rep_node, num_lanes); | 529 ReplaceNode(node, rep_node, num_lanes); |
457 } | 530 } |
458 | 531 |
459 void SimdScalarLowering::LowerIntMinMax(Node* node, const Operator* op, | 532 void SimdScalarLowering::LowerIntMinMax(Node* node, const Operator* op, |
460 bool is_max, SimdType type) { | 533 bool is_max, SimdType type) { |
461 DCHECK(node->InputCount() == 2); | 534 DCHECK(node->InputCount() == 2); |
462 Node** rep_left = GetReplacementsWithType(node->InputAt(0), type); | 535 Node** rep_left = GetReplacementsWithType(node->InputAt(0), type); |
463 Node** rep_right = GetReplacementsWithType(node->InputAt(1), type); | 536 Node** rep_right = GetReplacementsWithType(node->InputAt(1), type); |
464 int num_lanes = NumLanes(type); | 537 int num_lanes = NumLanes(type); |
465 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 538 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
466 MachineRepresentation rep = MachineRepresentation::kNone; | 539 MachineRepresentation rep = MachineRepresentation::kNone; |
467 if (type == SimdType::kInt32x4) { | 540 if (type == SimdType::kInt32x4) { |
468 rep = MachineRepresentation::kWord32; | 541 rep = MachineRepresentation::kWord32; |
469 } else if (type == SimdType::kInt16x8) { | 542 } else if (type == SimdType::kInt16x8) { |
470 rep = MachineRepresentation::kWord16; | 543 rep = MachineRepresentation::kWord16; |
544 } else if (type == SimdType::kInt8x16) { | |
545 rep = MachineRepresentation::kWord8; | |
471 } else { | 546 } else { |
472 UNREACHABLE(); | 547 UNREACHABLE(); |
473 } | 548 } |
474 for (int i = 0; i < num_lanes; ++i) { | 549 for (int i = 0; i < num_lanes; ++i) { |
475 Diamond d(graph(), common(), | 550 Diamond d(graph(), common(), |
476 graph()->NewNode(op, rep_left[i], rep_right[i])); | 551 graph()->NewNode(op, rep_left[i], rep_right[i])); |
477 if (is_max) { | 552 if (is_max) { |
478 rep_node[i] = d.Phi(rep, rep_right[i], rep_left[i]); | 553 rep_node[i] = d.Phi(rep, rep_right[i], rep_left[i]); |
479 } else { | 554 } else { |
480 rep_node[i] = d.Phi(rep, rep_left[i], rep_right[i]); | 555 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... | |
549 void SimdScalarLowering::LowerShiftOp(Node* node, SimdType type) { | 624 void SimdScalarLowering::LowerShiftOp(Node* node, SimdType type) { |
550 DCHECK_EQ(1, node->InputCount()); | 625 DCHECK_EQ(1, node->InputCount()); |
551 int32_t shift_amount = OpParameter<int32_t>(node); | 626 int32_t shift_amount = OpParameter<int32_t>(node); |
552 Node* shift_node = graph()->NewNode(common()->Int32Constant(shift_amount)); | 627 Node* shift_node = graph()->NewNode(common()->Int32Constant(shift_amount)); |
553 Node** rep = GetReplacementsWithType(node->InputAt(0), type); | 628 Node** rep = GetReplacementsWithType(node->InputAt(0), type); |
554 int num_lanes = NumLanes(type); | 629 int num_lanes = NumLanes(type); |
555 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 630 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
556 for (int i = 0; i < num_lanes; ++i) { | 631 for (int i = 0; i < num_lanes; ++i) { |
557 rep_node[i] = rep[i]; | 632 rep_node[i] = rep[i]; |
558 switch (node->opcode()) { | 633 switch (node->opcode()) { |
634 case IrOpcode::kI8x16ShrU: | |
635 rep_node[i] = Mask(rep_node[i], kMask8); | |
636 rep_node[i] = | |
637 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); | |
638 break; | |
559 case IrOpcode::kI16x8ShrU: | 639 case IrOpcode::kI16x8ShrU: |
560 rep_node[i] = Mask(rep_node[i], kMask16); // Fall through. | 640 rep_node[i] = Mask(rep_node[i], kMask16); // Fall through. |
561 case IrOpcode::kI32x4ShrU: | 641 case IrOpcode::kI32x4ShrU: |
562 rep_node[i] = | 642 rep_node[i] = |
563 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); | 643 graph()->NewNode(machine()->Word32Shr(), rep_node[i], shift_node); |
564 break; | 644 break; |
565 case IrOpcode::kI32x4Shl: | 645 case IrOpcode::kI32x4Shl: |
566 rep_node[i] = | 646 rep_node[i] = |
567 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); | 647 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); |
568 break; | 648 break; |
569 case IrOpcode::kI16x8Shl: | 649 case IrOpcode::kI16x8Shl: |
570 rep_node[i] = | 650 rep_node[i] = |
571 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); | 651 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); |
572 rep_node[i] = FixUpperBits(rep_node[i], kShift16); | 652 rep_node[i] = FixUpperBits(rep_node[i], kShift16); |
573 break; | 653 break; |
654 case IrOpcode::kI8x16Shl: | |
655 rep_node[i] = | |
656 graph()->NewNode(machine()->Word32Shl(), rep_node[i], shift_node); | |
657 rep_node[i] = FixUpperBits(rep_node[i], kShift24); | |
658 break; | |
574 case IrOpcode::kI32x4ShrS: | 659 case IrOpcode::kI32x4ShrS: |
575 case IrOpcode::kI16x8ShrS: | 660 case IrOpcode::kI16x8ShrS: |
661 case IrOpcode::kI8x16ShrS: | |
576 rep_node[i] = | 662 rep_node[i] = |
577 graph()->NewNode(machine()->Word32Sar(), rep_node[i], shift_node); | 663 graph()->NewNode(machine()->Word32Sar(), rep_node[i], shift_node); |
578 break; | 664 break; |
579 default: | 665 default: |
580 UNREACHABLE(); | 666 UNREACHABLE(); |
581 } | 667 } |
582 } | 668 } |
583 ReplaceNode(node, rep_node, num_lanes); | 669 ReplaceNode(node, rep_node, num_lanes); |
584 } | 670 } |
585 | 671 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 LowerBinaryOp(node, rep_type, machine()->instruction()); \ | 860 LowerBinaryOp(node, rep_type, machine()->instruction()); \ |
775 break; \ | 861 break; \ |
776 } | 862 } |
777 I32X4_BINOP_CASE(kI32x4Add, Int32Add) | 863 I32X4_BINOP_CASE(kI32x4Add, Int32Add) |
778 I32X4_BINOP_CASE(kI32x4Sub, Int32Sub) | 864 I32X4_BINOP_CASE(kI32x4Sub, Int32Sub) |
779 I32X4_BINOP_CASE(kI32x4Mul, Int32Mul) | 865 I32X4_BINOP_CASE(kI32x4Mul, Int32Mul) |
780 I32X4_BINOP_CASE(kS128And, Word32And) | 866 I32X4_BINOP_CASE(kS128And, Word32And) |
781 I32X4_BINOP_CASE(kS128Or, Word32Or) | 867 I32X4_BINOP_CASE(kS128Or, Word32Or) |
782 I32X4_BINOP_CASE(kS128Xor, Word32Xor) | 868 I32X4_BINOP_CASE(kS128Xor, Word32Xor) |
783 #undef I32X4_BINOP_CASE | 869 #undef I32X4_BINOP_CASE |
784 case IrOpcode::kI16x8Add: { | 870 case IrOpcode::kI16x8Add: |
871 case IrOpcode::kI8x16Add: { | |
785 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Add()); | 872 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Add()); |
786 break; | 873 break; |
787 } | 874 } |
788 case IrOpcode::kI16x8Sub: { | 875 case IrOpcode::kI16x8Sub: |
876 case IrOpcode::kI8x16Sub: { | |
789 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Sub()); | 877 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Sub()); |
790 break; | 878 break; |
791 } | 879 } |
792 case IrOpcode::kI16x8Mul: { | 880 case IrOpcode::kI16x8Mul: |
881 case IrOpcode::kI8x16Mul: { | |
793 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Mul()); | 882 LowerBinaryOpForSmallInt(node, rep_type, machine()->Int32Mul()); |
794 break; | 883 break; |
795 } | 884 } |
796 case IrOpcode::kI16x8AddSaturateS: { | 885 case IrOpcode::kI16x8AddSaturateS: |
886 case IrOpcode::kI8x16AddSaturateS: { | |
797 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), true); | 887 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), true); |
798 break; | 888 break; |
799 } | 889 } |
800 case IrOpcode::kI16x8SubSaturateS: { | 890 case IrOpcode::kI16x8SubSaturateS: |
891 case IrOpcode::kI8x16SubSaturateS: { | |
801 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), true); | 892 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), true); |
802 break; | 893 break; |
803 } | 894 } |
804 case IrOpcode::kI16x8AddSaturateU: { | 895 case IrOpcode::kI16x8AddSaturateU: |
896 case IrOpcode::kI8x16AddSaturateU: { | |
805 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), false); | 897 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Add(), false); |
806 break; | 898 break; |
807 } | 899 } |
808 case IrOpcode::kI16x8SubSaturateU: { | 900 case IrOpcode::kI16x8SubSaturateU: |
901 case IrOpcode::kI8x16SubSaturateU: { | |
809 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), false); | 902 LowerSaturateBinaryOp(node, rep_type, machine()->Int32Sub(), false); |
810 break; | 903 break; |
811 } | 904 } |
812 case IrOpcode::kI32x4MaxS: | 905 case IrOpcode::kI32x4MaxS: |
813 case IrOpcode::kI16x8MaxS: { | 906 case IrOpcode::kI16x8MaxS: |
907 case IrOpcode::kI8x16MaxS: { | |
814 LowerIntMinMax(node, machine()->Int32LessThan(), true, rep_type); | 908 LowerIntMinMax(node, machine()->Int32LessThan(), true, rep_type); |
815 break; | 909 break; |
816 } | 910 } |
817 case IrOpcode::kI32x4MinS: | 911 case IrOpcode::kI32x4MinS: |
818 case IrOpcode::kI16x8MinS: { | 912 case IrOpcode::kI16x8MinS: |
913 case IrOpcode::kI8x16MinS: { | |
819 LowerIntMinMax(node, machine()->Int32LessThan(), false, rep_type); | 914 LowerIntMinMax(node, machine()->Int32LessThan(), false, rep_type); |
820 break; | 915 break; |
821 } | 916 } |
822 case IrOpcode::kI32x4MaxU: | 917 case IrOpcode::kI32x4MaxU: |
823 case IrOpcode::kI16x8MaxU: { | 918 case IrOpcode::kI16x8MaxU: |
919 case IrOpcode::kI8x16MaxU: { | |
824 LowerIntMinMax(node, machine()->Uint32LessThan(), true, rep_type); | 920 LowerIntMinMax(node, machine()->Uint32LessThan(), true, rep_type); |
825 break; | 921 break; |
826 } | 922 } |
827 case IrOpcode::kI32x4MinU: | 923 case IrOpcode::kI32x4MinU: |
828 case IrOpcode::kI16x8MinU: { | 924 case IrOpcode::kI16x8MinU: |
925 case IrOpcode::kI8x16MinU: { | |
829 LowerIntMinMax(node, machine()->Uint32LessThan(), false, rep_type); | 926 LowerIntMinMax(node, machine()->Uint32LessThan(), false, rep_type); |
830 break; | 927 break; |
831 } | 928 } |
832 case IrOpcode::kI32x4Neg: { | 929 case IrOpcode::kI32x4Neg: |
930 case IrOpcode::kI8x16Neg: { | |
833 DCHECK(node->InputCount() == 1); | 931 DCHECK(node->InputCount() == 1); |
834 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); | 932 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); |
835 Node* rep_node[kNumLanes32]; | 933 int num_lanes = NumLanes(rep_type); |
934 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | |
836 Node* zero = graph()->NewNode(common()->Int32Constant(0)); | 935 Node* zero = graph()->NewNode(common()->Int32Constant(0)); |
837 for (int i = 0; i < kNumLanes32; ++i) { | 936 for (int i = 0; i < num_lanes; ++i) { |
838 rep_node[i] = graph()->NewNode(machine()->Int32Sub(), zero, rep[i]); | 937 rep_node[i] = graph()->NewNode(machine()->Int32Sub(), zero, rep[i]); |
938 if (node->opcode() == IrOpcode::kI8x16Neg) { | |
939 rep_node[i] = FixUpperBits(rep_node[i], kShift24); | |
940 } | |
839 } | 941 } |
840 ReplaceNode(node, rep_node, kNumLanes32); | 942 ReplaceNode(node, rep_node, num_lanes); |
841 break; | 943 break; |
842 } | 944 } |
843 case IrOpcode::kS128Not: { | 945 case IrOpcode::kS128Not: { |
844 DCHECK(node->InputCount() == 1); | 946 DCHECK(node->InputCount() == 1); |
845 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); | 947 Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); |
846 Node* rep_node[kNumLanes32]; | 948 Node* rep_node[kNumLanes32]; |
847 Node* mask = graph()->NewNode(common()->Int32Constant(0xffffffff)); | 949 Node* mask = graph()->NewNode(common()->Int32Constant(0xffffffff)); |
848 for (int i = 0; i < kNumLanes32; ++i) { | 950 for (int i = 0; i < kNumLanes32; ++i) { |
849 rep_node[i] = graph()->NewNode(machine()->Word32Xor(), rep[i], mask); | 951 rep_node[i] = graph()->NewNode(machine()->Word32Xor(), rep[i], mask); |
850 } | 952 } |
851 ReplaceNode(node, rep_node, kNumLanes32); | 953 ReplaceNode(node, rep_node, kNumLanes32); |
852 break; | 954 break; |
853 } | 955 } |
854 case IrOpcode::kI32x4SConvertF32x4: { | 956 case IrOpcode::kI32x4SConvertF32x4: { |
855 LowerConvertFromFloat(node, true); | 957 LowerConvertFromFloat(node, true); |
856 break; | 958 break; |
857 } | 959 } |
858 case IrOpcode::kI32x4UConvertF32x4: { | 960 case IrOpcode::kI32x4UConvertF32x4: { |
859 LowerConvertFromFloat(node, false); | 961 LowerConvertFromFloat(node, false); |
860 break; | 962 break; |
861 } | 963 } |
862 case IrOpcode::kI32x4Shl: | 964 case IrOpcode::kI32x4Shl: |
863 case IrOpcode::kI16x8Shl: | 965 case IrOpcode::kI16x8Shl: |
966 case IrOpcode::kI8x16Shl: | |
864 case IrOpcode::kI32x4ShrS: | 967 case IrOpcode::kI32x4ShrS: |
865 case IrOpcode::kI16x8ShrS: | 968 case IrOpcode::kI16x8ShrS: |
969 case IrOpcode::kI8x16ShrS: | |
866 case IrOpcode::kI32x4ShrU: | 970 case IrOpcode::kI32x4ShrU: |
867 case IrOpcode::kI16x8ShrU: { | 971 case IrOpcode::kI16x8ShrU: |
972 case IrOpcode::kI8x16ShrU: { | |
868 LowerShiftOp(node, rep_type); | 973 LowerShiftOp(node, rep_type); |
869 break; | 974 break; |
870 } | 975 } |
871 #define F32X4_BINOP_CASE(name) \ | 976 #define F32X4_BINOP_CASE(name) \ |
872 case IrOpcode::kF32x4##name: { \ | 977 case IrOpcode::kF32x4##name: { \ |
873 LowerBinaryOp(node, rep_type, machine()->Float32##name()); \ | 978 LowerBinaryOp(node, rep_type, machine()->Float32##name()); \ |
874 break; \ | 979 break; \ |
875 } | 980 } |
876 F32X4_BINOP_CASE(Add) | 981 F32X4_BINOP_CASE(Add) |
877 F32X4_BINOP_CASE(Sub) | 982 F32X4_BINOP_CASE(Sub) |
(...skipping 12 matching lines...) Expand all Loading... | |
890 case IrOpcode::kF32x4SConvertI32x4: { | 995 case IrOpcode::kF32x4SConvertI32x4: { |
891 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundInt32ToFloat32()); | 996 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundInt32ToFloat32()); |
892 break; | 997 break; |
893 } | 998 } |
894 case IrOpcode::kF32x4UConvertI32x4: { | 999 case IrOpcode::kF32x4UConvertI32x4: { |
895 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundUint32ToFloat32()); | 1000 LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundUint32ToFloat32()); |
896 break; | 1001 break; |
897 } | 1002 } |
898 case IrOpcode::kI32x4Splat: | 1003 case IrOpcode::kI32x4Splat: |
899 case IrOpcode::kF32x4Splat: | 1004 case IrOpcode::kF32x4Splat: |
900 case IrOpcode::kI16x8Splat: { | 1005 case IrOpcode::kI16x8Splat: |
1006 case IrOpcode::kI8x16Splat: { | |
901 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1007 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
902 for (int i = 0; i < num_lanes; ++i) { | 1008 for (int i = 0; i < num_lanes; ++i) { |
903 if (HasReplacement(0, node->InputAt(0))) { | 1009 if (HasReplacement(0, node->InputAt(0))) { |
904 rep_node[i] = GetReplacements(node->InputAt(0))[0]; | 1010 rep_node[i] = GetReplacements(node->InputAt(0))[0]; |
905 } else { | 1011 } else { |
906 rep_node[i] = node->InputAt(0); | 1012 rep_node[i] = node->InputAt(0); |
907 } | 1013 } |
908 } | 1014 } |
909 ReplaceNode(node, rep_node, num_lanes); | 1015 ReplaceNode(node, rep_node, num_lanes); |
910 break; | 1016 break; |
911 } | 1017 } |
912 case IrOpcode::kI32x4ExtractLane: | 1018 case IrOpcode::kI32x4ExtractLane: |
913 case IrOpcode::kF32x4ExtractLane: | 1019 case IrOpcode::kF32x4ExtractLane: |
914 case IrOpcode::kI16x8ExtractLane: { | 1020 case IrOpcode::kI16x8ExtractLane: |
1021 case IrOpcode::kI8x16ExtractLane: { | |
915 int32_t lane = OpParameter<int32_t>(node); | 1022 int32_t lane = OpParameter<int32_t>(node); |
916 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1023 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
917 rep_node[0] = GetReplacementsWithType(node->InputAt(0), rep_type)[lane]; | 1024 rep_node[0] = GetReplacementsWithType(node->InputAt(0), rep_type)[lane]; |
918 for (int i = 1; i < num_lanes; ++i) { | 1025 for (int i = 1; i < num_lanes; ++i) { |
919 rep_node[i] = nullptr; | 1026 rep_node[i] = nullptr; |
920 } | 1027 } |
921 ReplaceNode(node, rep_node, num_lanes); | 1028 ReplaceNode(node, rep_node, num_lanes); |
922 break; | 1029 break; |
923 } | 1030 } |
924 case IrOpcode::kI32x4ReplaceLane: | 1031 case IrOpcode::kI32x4ReplaceLane: |
925 case IrOpcode::kF32x4ReplaceLane: | 1032 case IrOpcode::kF32x4ReplaceLane: |
926 case IrOpcode::kI16x8ReplaceLane: { | 1033 case IrOpcode::kI16x8ReplaceLane: |
1034 case IrOpcode::kI8x16ReplaceLane: { | |
927 DCHECK_EQ(2, node->InputCount()); | 1035 DCHECK_EQ(2, node->InputCount()); |
928 Node* repNode = node->InputAt(1); | 1036 Node* repNode = node->InputAt(1); |
929 int32_t lane = OpParameter<int32_t>(node); | 1037 int32_t lane = OpParameter<int32_t>(node); |
930 Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type); | 1038 Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type); |
931 if (HasReplacement(0, repNode)) { | 1039 if (HasReplacement(0, repNode)) { |
932 rep_node[lane] = GetReplacements(repNode)[0]; | 1040 rep_node[lane] = GetReplacements(repNode)[0]; |
933 } else { | 1041 } else { |
934 rep_node[lane] = repNode; | 1042 rep_node[lane] = repNode; |
935 } | 1043 } |
936 ReplaceNode(node, rep_node, num_lanes); | 1044 ReplaceNode(node, rep_node, num_lanes); |
(...skipping 20 matching lines...) Expand all Loading... | |
957 COMPARISON_CASE(Int32x4, kI32x4GeU, Uint32LessThanOrEqual, true) | 1065 COMPARISON_CASE(Int32x4, kI32x4GeU, Uint32LessThanOrEqual, true) |
958 COMPARISON_CASE(Int16x8, kI16x8Eq, Word32Equal, false) | 1066 COMPARISON_CASE(Int16x8, kI16x8Eq, Word32Equal, false) |
959 COMPARISON_CASE(Int16x8, kI16x8LtS, Int32LessThan, false) | 1067 COMPARISON_CASE(Int16x8, kI16x8LtS, Int32LessThan, false) |
960 COMPARISON_CASE(Int16x8, kI16x8LeS, Int32LessThanOrEqual, false) | 1068 COMPARISON_CASE(Int16x8, kI16x8LeS, Int32LessThanOrEqual, false) |
961 COMPARISON_CASE(Int16x8, kI16x8GtS, Int32LessThan, true) | 1069 COMPARISON_CASE(Int16x8, kI16x8GtS, Int32LessThan, true) |
962 COMPARISON_CASE(Int16x8, kI16x8GeS, Int32LessThanOrEqual, true) | 1070 COMPARISON_CASE(Int16x8, kI16x8GeS, Int32LessThanOrEqual, true) |
963 COMPARISON_CASE(Int16x8, kI16x8LtU, Uint32LessThan, false) | 1071 COMPARISON_CASE(Int16x8, kI16x8LtU, Uint32LessThan, false) |
964 COMPARISON_CASE(Int16x8, kI16x8LeU, Uint32LessThanOrEqual, false) | 1072 COMPARISON_CASE(Int16x8, kI16x8LeU, Uint32LessThanOrEqual, false) |
965 COMPARISON_CASE(Int16x8, kI16x8GtU, Uint32LessThan, true) | 1073 COMPARISON_CASE(Int16x8, kI16x8GtU, Uint32LessThan, true) |
966 COMPARISON_CASE(Int16x8, kI16x8GeU, Uint32LessThanOrEqual, true) | 1074 COMPARISON_CASE(Int16x8, kI16x8GeU, Uint32LessThanOrEqual, true) |
1075 COMPARISON_CASE(Int8x16, kI8x16Eq, Word32Equal, false) | |
1076 COMPARISON_CASE(Int8x16, kI8x16LtS, Int32LessThan, false) | |
1077 COMPARISON_CASE(Int8x16, kI8x16LeS, Int32LessThanOrEqual, false) | |
1078 COMPARISON_CASE(Int8x16, kI8x16GtS, Int32LessThan, true) | |
1079 COMPARISON_CASE(Int8x16, kI8x16GeS, Int32LessThanOrEqual, true) | |
1080 COMPARISON_CASE(Int8x16, kI8x16LtU, Uint32LessThan, false) | |
1081 COMPARISON_CASE(Int8x16, kI8x16LeU, Uint32LessThanOrEqual, false) | |
1082 COMPARISON_CASE(Int8x16, kI8x16GtU, Uint32LessThan, true) | |
1083 COMPARISON_CASE(Int8x16, kI8x16GeU, Uint32LessThanOrEqual, true) | |
967 #undef COMPARISON_CASE | 1084 #undef COMPARISON_CASE |
968 case IrOpcode::kF32x4Ne: { | 1085 case IrOpcode::kF32x4Ne: { |
969 LowerNotEqual(node, SimdType::kFloat32x4, machine()->Float32Equal()); | 1086 LowerNotEqual(node, SimdType::kFloat32x4, machine()->Float32Equal()); |
970 break; | 1087 break; |
971 } | 1088 } |
972 case IrOpcode::kI32x4Ne: { | 1089 case IrOpcode::kI32x4Ne: { |
973 LowerNotEqual(node, SimdType::kInt32x4, machine()->Word32Equal()); | 1090 LowerNotEqual(node, SimdType::kInt32x4, machine()->Word32Equal()); |
974 break; | 1091 break; |
975 } | 1092 } |
976 case IrOpcode::kI16x8Ne: { | 1093 case IrOpcode::kI16x8Ne: { |
977 LowerNotEqual(node, SimdType::kInt16x8, machine()->Word32Equal()); | 1094 LowerNotEqual(node, SimdType::kInt16x8, machine()->Word32Equal()); |
978 break; | 1095 break; |
979 } | 1096 } |
1097 case IrOpcode::kI8x16Ne: { | |
1098 LowerNotEqual(node, SimdType::kInt8x16, machine()->Word32Equal()); | |
1099 break; | |
1100 } | |
980 case IrOpcode::kS32x4Select: | 1101 case IrOpcode::kS32x4Select: |
981 case IrOpcode::kS16x8Select: { | 1102 case IrOpcode::kS16x8Select: |
1103 case IrOpcode::kS8x16Select: { | |
982 DCHECK(node->InputCount() == 3); | 1104 DCHECK(node->InputCount() == 3); |
983 DCHECK(ReplacementType(node->InputAt(0)) == SimdType::kSimd1x4 || | 1105 DCHECK(ReplacementType(node->InputAt(0)) == SimdType::kSimd1x4 || |
984 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x8); | 1106 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x8 || |
1107 ReplacementType(node->InputAt(0)) == SimdType::kSimd1x16); | |
985 Node** boolean_input = GetReplacements(node->InputAt(0)); | 1108 Node** boolean_input = GetReplacements(node->InputAt(0)); |
986 Node** rep_left = GetReplacementsWithType(node->InputAt(1), rep_type); | 1109 Node** rep_left = GetReplacementsWithType(node->InputAt(1), rep_type); |
987 Node** rep_right = GetReplacementsWithType(node->InputAt(2), rep_type); | 1110 Node** rep_right = GetReplacementsWithType(node->InputAt(2), rep_type); |
988 Node** rep_node = zone()->NewArray<Node*>(num_lanes); | 1111 Node** rep_node = zone()->NewArray<Node*>(num_lanes); |
989 for (int i = 0; i < num_lanes; ++i) { | 1112 for (int i = 0; i < num_lanes; ++i) { |
990 Diamond d(graph(), common(), | 1113 Diamond d(graph(), common(), |
991 graph()->NewNode(machine()->Word32Equal(), boolean_input[i], | 1114 graph()->NewNode(machine()->Word32Equal(), boolean_input[i], |
992 jsgraph_->Int32Constant(0))); | 1115 jsgraph_->Int32Constant(0))); |
993 #define SELECT_CASE(sType, mType) \ | 1116 #define SELECT_CASE(sType, mType) \ |
994 case SimdType::k##sType: \ | 1117 case SimdType::k##sType: \ |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1148 UNREACHABLE(); | 1271 UNREACHABLE(); |
1149 } | 1272 } |
1150 #undef PHI_CASE | 1273 #undef PHI_CASE |
1151 } | 1274 } |
1152 ReplaceNode(phi, rep_nodes, num_lanes); | 1275 ReplaceNode(phi, rep_nodes, num_lanes); |
1153 } | 1276 } |
1154 } | 1277 } |
1155 } // namespace compiler | 1278 } // namespace compiler |
1156 } // namespace internal | 1279 } // namespace internal |
1157 } // namespace v8 | 1280 } // namespace v8 |
OLD | NEW |