Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: src/compiler/s390/code-generator-s390.cc

Issue 2722313003: s390: optimize for int 64-bit operation and cleanup (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/s390/instruction-selector-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compilation-info.h" 7 #include "src/compilation-info.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 #else 128 #else
129 return InputStackSlot(index); 129 return InputStackSlot(index);
130 #endif 130 #endif
131 } 131 }
132 }; 132 };
133 133
134 static inline bool HasRegisterOutput(Instruction* instr, int index = 0) { 134 static inline bool HasRegisterOutput(Instruction* instr, int index = 0) {
135 return instr->OutputCount() > 0 && instr->OutputAt(index)->IsRegister(); 135 return instr->OutputCount() > 0 && instr->OutputAt(index)->IsRegister();
136 } 136 }
137 137
138 static inline bool HasRegisterInput(Instruction* instr, int index) {
139 return instr->InputAt(index)->IsRegister();
140 }
141
142 static inline bool HasFPRegisterInput(Instruction* instr, int index) { 138 static inline bool HasFPRegisterInput(Instruction* instr, int index) {
143 return instr->InputAt(index)->IsFPRegister(); 139 return instr->InputAt(index)->IsFPRegister();
144 } 140 }
145 141
142 static inline bool HasRegisterInput(Instruction* instr, int index) {
143 return instr->InputAt(index)->IsRegister() ||
144 HasFPRegisterInput(instr, index);
145 }
146
146 static inline bool HasImmediateInput(Instruction* instr, size_t index) { 147 static inline bool HasImmediateInput(Instruction* instr, size_t index) {
147 return instr->InputAt(index)->IsImmediate(); 148 return instr->InputAt(index)->IsImmediate();
148 } 149 }
149 150
150 static inline bool HasStackSlotInput(Instruction* instr, size_t index) {
151 return instr->InputAt(index)->IsStackSlot();
152 }
153
154 static inline bool HasFPStackSlotInput(Instruction* instr, size_t index) { 151 static inline bool HasFPStackSlotInput(Instruction* instr, size_t index) {
155 return instr->InputAt(index)->IsFPStackSlot(); 152 return instr->InputAt(index)->IsFPStackSlot();
156 } 153 }
157 154
155 static inline bool HasStackSlotInput(Instruction* instr, size_t index) {
156 return instr->InputAt(index)->IsStackSlot() ||
157 HasFPStackSlotInput(instr, index);
158 }
159
158 namespace { 160 namespace {
159 161
160 class OutOfLineLoadNAN32 final : public OutOfLineCode { 162 class OutOfLineLoadNAN32 final : public OutOfLineCode {
161 public: 163 public:
162 OutOfLineLoadNAN32(CodeGenerator* gen, DoubleRegister result) 164 OutOfLineLoadNAN32(CodeGenerator* gen, DoubleRegister result)
163 : OutOfLineCode(gen), result_(result) {} 165 : OutOfLineCode(gen), result_(result) {}
164 166
165 void Generate() final { 167 void Generate() final {
166 __ LoadDoubleLiteral(result_, std::numeric_limits<float>::quiet_NaN(), 168 __ LoadDoubleLiteral(result_, std::numeric_limits<float>::quiet_NaN(),
167 kScratchReg); 169 kScratchReg);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 break; 325 break;
324 } 326 }
325 break; 327 break;
326 default: 328 default:
327 break; 329 break;
328 } 330 }
329 UNREACHABLE(); 331 UNREACHABLE();
330 return kNoCondition; 332 return kNoCondition;
331 } 333 }
332 334
333 typedef void (MacroAssembler::*RRTypeInstr)(Register, Register); 335 #define GET_MEMOPERAND32(ret, fi) \
334 typedef void (MacroAssembler::*RMTypeInstr)(Register, const MemOperand&); 336 ([&](int& ret) { \
335 typedef void (MacroAssembler::*RITypeInstr)(Register, const Operand&); 337 AddressingMode mode = AddressingModeField::decode(instr->opcode()); \
336 typedef void (MacroAssembler::*RRRTypeInstr)(Register, Register, Register); 338 MemOperand mem(r0); \
337 typedef void (MacroAssembler::*RRMTypeInstr)(Register, Register, 339 if (mode != kMode_None) { \
338 const MemOperand&); 340 size_t first_index = (fi); \
339 typedef void (MacroAssembler::*RRITypeInstr)(Register, Register, 341 mem = i.MemoryOperand(&mode, &first_index); \
340 const Operand&); 342 ret = first_index; \
343 } else { \
344 mem = i.InputStackSlot32(fi); \
345 } \
346 return mem; \
347 })(ret)
341 348
342 #define CHECK_AND_ZERO_EXT_OUTPUT(num) \ 349 #define GET_MEMOPERAND(ret, fi) \
343 { \ 350 ([&](int& ret) { \
344 CHECK(HasImmediateInput(instr, (num))); \ 351 AddressingMode mode = AddressingModeField::decode(instr->opcode()); \
345 int doZeroExt = i.InputInt32(num); \ 352 MemOperand mem(r0); \
346 if (doZeroExt) masm->LoadlW(i.OutputRegister(), i.OutputRegister()); \ 353 if (mode != kMode_None) { \
354 size_t first_index = (fi); \
355 mem = i.MemoryOperand(&mode, &first_index); \
356 ret = first_index; \
357 } else { \
358 mem = i.InputStackSlot(fi); \
359 } \
360 return mem; \
361 })(ret)
362
363 #define RRInstr(instr) \
364 [&]() { \
365 DCHECK(i.OutputRegister().is(i.InputRegister(0))); \
366 __ instr(i.OutputRegister(), i.InputRegister(1)); \
367 return 2; \
368 }
369 #define RIInstr(instr) \
370 [&]() { \
371 DCHECK(i.OutputRegister().is(i.InputRegister(0))); \
372 __ instr(i.OutputRegister(), i.InputImmediate(1)); \
373 return 2; \
374 }
375 #define RMInstr(instr, GETMEM) \
376 [&]() { \
377 DCHECK(i.OutputRegister().is(i.InputRegister(0))); \
378 int ret = 2; \
379 __ instr(i.OutputRegister(), GETMEM(ret, 1)); \
380 return ret; \
381 }
382 #define RM32Instr(instr) RMInstr(instr, GET_MEMOPERAND32)
383 #define RM64Instr(instr) RMInstr(instr, GET_MEMOPERAND)
384
385 #define RRRInstr(instr) \
386 [&]() { \
387 __ instr(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); \
388 return 2; \
389 }
390 #define RRIInstr(instr) \
391 [&]() { \
392 __ instr(i.OutputRegister(), i.InputRegister(0), i.InputImmediate(1)); \
393 return 2; \
394 }
395 #define RRMInstr(instr, GETMEM) \
396 [&]() { \
397 int ret = 2; \
398 __ instr(i.OutputRegister(), i.InputRegister(0), GETMEM(ret, 1)); \
399 return ret; \
400 }
401 #define RRM32Instr(instr) RRMInstr(instr, GET_MEMOPERAND32)
402 #define RRM64Instr(instr) RRMInstr(instr, GET_MEMOPERAND)
403
404 #define DDInstr(instr) \
405 [&]() { \
406 DCHECK(i.OutputDoubleRegister().is(i.InputDoubleRegister(0))); \
407 __ instr(i.OutputDoubleRegister(), i.InputDoubleRegister(1)); \
408 return 2; \
347 } 409 }
348 410
349 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 411 #define DMInstr(instr) \
350 Instruction* instr, RRTypeInstr rr_instr, 412 [&]() { \
351 RMTypeInstr rm_instr, RITypeInstr ri_instr) { 413 DCHECK(i.OutputDoubleRegister().is(i.InputDoubleRegister(0))); \
352 CHECK(i.OutputRegister().is(i.InputRegister(0))); 414 int ret = 2; \
415 __ instr(i.OutputDoubleRegister(), GET_MEMOPERAND(ret, 1)); \
416 return ret; \
417 }
418
419 #define DMTInstr(instr) \
420 [&]() { \
421 DCHECK(i.OutputDoubleRegister().is(i.InputDoubleRegister(0))); \
422 int ret = 2; \
423 __ instr(i.OutputDoubleRegister(), GET_MEMOPERAND(ret, 1), \
424 kScratchDoubleReg); \
425 return ret; \
426 }
427
428 #define R_MInstr(instr) \
429 [&]() { \
430 int ret = 2; \
431 __ instr(i.OutputRegister(), GET_MEMOPERAND(ret, 0)); \
432 return ret; \
433 }
434
435 #define R_DInstr(instr) \
436 [&]() { \
437 __ instr(i.OutputRegister(), i.InputDoubleRegister(0)); \
438 return 2; \
439 }
440
441 #define D_DInstr(instr) \
442 [&]() { \
443 __ instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \
444 return 2; \
445 }
446
447 #define D_MInstr(instr) \
448 [&]() { \
449 int ret = 2; \
450 __ instr(i.OutputDoubleRegister(), GET_MEMOPERAND(ret, 0)); \
451 return ret; \
452 }
453
454 #define D_MTInstr(instr) \
455 [&]() { \
456 int ret = 2; \
457 __ instr(i.OutputDoubleRegister(), GET_MEMOPERAND(ret, 0), \
458 kScratchDoubleReg); \
459 return ret; \
460 }
461
462 static int nullInstr() {
463 UNREACHABLE();
464 return -1;
465 }
466
467 template <int numOfOperand, class RType, class MType, class IType>
468 static inline int AssembleOp(Instruction* instr, RType r, MType m, IType i) {
353 AddressingMode mode = AddressingModeField::decode(instr->opcode()); 469 AddressingMode mode = AddressingModeField::decode(instr->opcode());
354 int zeroExtIndex = 2; 470 if (mode != kMode_None || HasStackSlotInput(instr, numOfOperand - 1)) {
355 if (mode != kMode_None) { 471 return m();
356 size_t first_index = 1; 472 } else if (HasRegisterInput(instr, numOfOperand - 1)) {
357 MemOperand operand = i.MemoryOperand(&mode, &first_index); 473 return r();
358 zeroExtIndex = first_index; 474 } else if (HasImmediateInput(instr, numOfOperand - 1)) {
359 CHECK(rm_instr != NULL); 475 return i();
360 (masm->*rm_instr)(i.OutputRegister(), operand);
361 } else if (HasRegisterInput(instr, 1)) {
362 (masm->*rr_instr)(i.OutputRegister(), i.InputRegister(1));
363 } else if (HasImmediateInput(instr, 1)) {
364 (masm->*ri_instr)(i.OutputRegister(), i.InputImmediate(1));
365 } else if (HasStackSlotInput(instr, 1)) {
366 (masm->*rm_instr)(i.OutputRegister(), i.InputStackSlot32(1));
367 } else { 476 } else {
368 UNREACHABLE(); 477 UNREACHABLE();
478 return -1;
369 } 479 }
370 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
371 } 480 }
372 481
373 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 482 template <class _RR, class _RM, class _RI>
374 Instruction* instr, RRRTypeInstr rrr_instr, 483 static inline int AssembleBinOp(Instruction* instr, _RR _rr, _RM _rm, _RI _ri) {
375 RMTypeInstr rm_instr, RITypeInstr ri_instr) { 484 return AssembleOp<2>(instr, _rr, _rm, _ri);
376 AddressingMode mode = AddressingModeField::decode(instr->opcode());
377 int zeroExtIndex = 2;
378 if (mode != kMode_None) {
379 CHECK(i.OutputRegister().is(i.InputRegister(0)));
380 size_t first_index = 1;
381 MemOperand operand = i.MemoryOperand(&mode, &first_index);
382 zeroExtIndex = first_index;
383 CHECK(rm_instr != NULL);
384 (masm->*rm_instr)(i.OutputRegister(), operand);
385 } else if (HasRegisterInput(instr, 1)) {
386 (masm->*rrr_instr)(i.OutputRegister(), i.InputRegister(0),
387 i.InputRegister(1));
388 } else if (HasImmediateInput(instr, 1)) {
389 CHECK(i.OutputRegister().is(i.InputRegister(0)));
390 (masm->*ri_instr)(i.OutputRegister(), i.InputImmediate(1));
391 } else if (HasStackSlotInput(instr, 1)) {
392 CHECK(i.OutputRegister().is(i.InputRegister(0)));
393 (masm->*rm_instr)(i.OutputRegister(), i.InputStackSlot32(1));
394 } else {
395 UNREACHABLE();
396 }
397 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
398 } 485 }
399 486
400 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 487 template <class _R, class _M, class _I>
401 Instruction* instr, RRRTypeInstr rrr_instr, 488 static inline int AssembleUnaryOp(Instruction* instr, _R _r, _M _m, _I _i) {
402 RMTypeInstr rm_instr, RRITypeInstr rri_instr) { 489 return AssembleOp<1>(instr, _r, _m, _i);
403 AddressingMode mode = AddressingModeField::decode(instr->opcode());
404 int zeroExtIndex = 2;
405 if (mode != kMode_None) {
406 CHECK(i.OutputRegister().is(i.InputRegister(0)));
407 size_t first_index = 1;
408 MemOperand operand = i.MemoryOperand(&mode, &first_index);
409 zeroExtIndex = first_index;
410 CHECK(rm_instr != NULL);
411 (masm->*rm_instr)(i.OutputRegister(), operand);
412 } else if (HasRegisterInput(instr, 1)) {
413 (masm->*rrr_instr)(i.OutputRegister(), i.InputRegister(0),
414 i.InputRegister(1));
415 } else if (HasImmediateInput(instr, 1)) {
416 (masm->*rri_instr)(i.OutputRegister(), i.InputRegister(0),
417 i.InputImmediate(1));
418 } else if (HasStackSlotInput(instr, 1)) {
419 CHECK(i.OutputRegister().is(i.InputRegister(0)));
420 (masm->*rm_instr)(i.OutputRegister(), i.InputStackSlot32(1));
421 } else {
422 UNREACHABLE();
423 }
424 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
425 } 490 }
426 491
427 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 492 #define CHECK_AND_ZERO_EXT_OUTPUT(num) \
428 Instruction* instr, RRRTypeInstr rrr_instr, 493 ([&](int index) { \
429 RRMTypeInstr rrm_instr, RRITypeInstr rri_instr) { 494 DCHECK(HasImmediateInput(instr, (index))); \
430 AddressingMode mode = AddressingModeField::decode(instr->opcode()); 495 int doZeroExt = i.InputInt32(index); \
431 int zeroExtIndex = 2; 496 if (doZeroExt) __ LoadlW(i.OutputRegister(), i.OutputRegister()); \
432 if (mode != kMode_None) { 497 })(num)
433 size_t first_index = 1;
434 MemOperand operand = i.MemoryOperand(&mode, &first_index);
435 zeroExtIndex = first_index;
436 CHECK(rrm_instr != NULL);
437 (masm->*rrm_instr)(i.OutputRegister(), i.InputRegister(0), operand);
438 } else if (HasRegisterInput(instr, 1)) {
439 (masm->*rrr_instr)(i.OutputRegister(), i.InputRegister(0),
440 i.InputRegister(1));
441 } else if (HasImmediateInput(instr, 1)) {
442 (masm->*rri_instr)(i.OutputRegister(), i.InputRegister(0),
443 i.InputImmediate(1));
444 } else if (HasStackSlotInput(instr, 1)) {
445 (masm->*rrm_instr)(i.OutputRegister(), i.InputRegister(0),
446 i.InputStackSlot32(1));
447 } else {
448 UNREACHABLE();
449 }
450 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
451 }
452 498
453 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 499 #define ASSEMBLE_BIN_OP(_rr, _rm, _ri) AssembleBinOp(instr, _rr, _rm, _ri)
454 Instruction* instr, RRRTypeInstr rrr_instr, 500 #define ASSEMBLE_UNARY_OP(_r, _m, _i) AssembleUnaryOp(instr, _r, _m, _i)
455 RRITypeInstr rri_instr) {
456 AddressingMode mode = AddressingModeField::decode(instr->opcode());
457 CHECK(mode == kMode_None);
458 int zeroExtIndex = 2;
459 if (HasRegisterInput(instr, 1)) {
460 (masm->*rrr_instr)(i.OutputRegister(), i.InputRegister(0),
461 i.InputRegister(1));
462 } else if (HasImmediateInput(instr, 1)) {
463 (masm->*rri_instr)(i.OutputRegister(), i.InputRegister(0),
464 i.InputImmediate(1));
465 } else {
466 UNREACHABLE();
467 }
468 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
469 }
470 501
471 void AssembleBinOp(S390OperandConverter& i, MacroAssembler* masm, 502 #define ASSEMBLE_BIN32_OP(_rr, _rm, _ri) \
472 Instruction* instr, RRTypeInstr rr_instr, 503 { CHECK_AND_ZERO_EXT_OUTPUT(AssembleBinOp(instr, _rr, _rm, _ri)); }
473 RITypeInstr ri_instr) {
474 AddressingMode mode = AddressingModeField::decode(instr->opcode());
475 CHECK(mode == kMode_None);
476 CHECK(i.OutputRegister().is(i.InputRegister(0)));
477 int zeroExtIndex = 2;
478 if (HasRegisterInput(instr, 1)) {
479 (masm->*rr_instr)(i.OutputRegister(), i.InputRegister(1));
480 } else if (HasImmediateInput(instr, 1)) {
481 (masm->*ri_instr)(i.OutputRegister(), i.InputImmediate(1));
482 } else {
483 UNREACHABLE();
484 }
485 CHECK_AND_ZERO_EXT_OUTPUT(zeroExtIndex);
486 }
487
488 #define ASSEMBLE_BIN_OP(instr1, instr2, instr3) \
489 AssembleBinOp(i, masm(), instr, &MacroAssembler::instr1, \
490 &MacroAssembler::instr2, &MacroAssembler::instr3)
491
492 #undef CHECK_AND_ZERO_EXT_OUTPUT
493 504
494 } // namespace 505 } // namespace
495 506
496 #define CHECK_AND_ZERO_EXT_OUTPUT(num) \
497 { \
498 CHECK(HasImmediateInput(instr, (num))); \
499 int doZeroExt = i.InputInt32(num); \
500 if (doZeroExt) __ LoadlW(i.OutputRegister(), i.OutputRegister()); \
501 }
502
503 #define ASSEMBLE_FLOAT_UNOP(asm_instr) \ 507 #define ASSEMBLE_FLOAT_UNOP(asm_instr) \
504 do { \ 508 do { \
505 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \ 509 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); \
506 } while (0) 510 } while (0)
507 511
508 #define ASSEMBLE_FLOAT_BINOP(asm_instr) \ 512 #define ASSEMBLE_FLOAT_BINOP(asm_instr) \
509 do { \ 513 do { \
510 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \ 514 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \
511 i.InputDoubleRegister(1)); \ 515 i.InputDoubleRegister(1)); \
512 } while (0) 516 } while (0)
513 517
514 #define ASSEMBLE_BINOP(asm_instr) \
515 do { \
516 if (HasRegisterInput(instr, 1)) { \
517 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \
518 i.InputRegister(1)); \
519 } else if (HasImmediateInput(instr, 1)) { \
520 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \
521 i.InputImmediate(1)); \
522 } else { \
523 UNIMPLEMENTED(); \
524 } \
525 } while (0)
526
527 #define ASSEMBLE_COMPARE(cmp_instr, cmpl_instr) \ 518 #define ASSEMBLE_COMPARE(cmp_instr, cmpl_instr) \
528 do { \ 519 do { \
529 AddressingMode mode = AddressingModeField::decode(instr->opcode()); \ 520 AddressingMode mode = AddressingModeField::decode(instr->opcode()); \
530 if (mode != kMode_None) { \ 521 if (mode != kMode_None) { \
531 size_t first_index = 1; \ 522 size_t first_index = 1; \
532 MemOperand operand = i.MemoryOperand(&mode, &first_index); \ 523 MemOperand operand = i.MemoryOperand(&mode, &first_index); \
533 if (i.CompareLogical()) { \ 524 if (i.CompareLogical()) { \
534 __ cmpl_instr(i.InputRegister(0), operand); \ 525 __ cmpl_instr(i.InputRegister(0), operand); \
535 } else { \ 526 } else { \
536 __ cmp_instr(i.InputRegister(0), operand); \ 527 __ cmp_instr(i.InputRegister(0), operand); \
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 } 1337 }
1347 case kArchStackSlot: { 1338 case kArchStackSlot: {
1348 FrameOffset offset = 1339 FrameOffset offset =
1349 frame_access_state()->GetFrameOffset(i.InputInt32(0)); 1340 frame_access_state()->GetFrameOffset(i.InputInt32(0));
1350 __ AddP(i.OutputRegister(), offset.from_stack_pointer() ? sp : fp, 1341 __ AddP(i.OutputRegister(), offset.from_stack_pointer() ? sp : fp,
1351 Operand(offset.offset())); 1342 Operand(offset.offset()));
1352 break; 1343 break;
1353 } 1344 }
1354 case kS390_And32: 1345 case kS390_And32:
1355 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1346 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1356 ASSEMBLE_BIN_OP(nrk, And, nilf); 1347 ASSEMBLE_BIN32_OP(RRRInstr(nrk), RM32Instr(And), RIInstr(nilf));
1357 } else { 1348 } else {
1358 ASSEMBLE_BIN_OP(nr, And, nilf); 1349 ASSEMBLE_BIN32_OP(RRInstr(nr), RM32Instr(And), RIInstr(nilf));
1359 } 1350 }
1360 break; 1351 break;
1361 case kS390_And64: 1352 case kS390_And64:
1362 ASSEMBLE_BINOP(AndP); 1353 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1354 ASSEMBLE_BIN_OP(RRRInstr(ngrk), RM64Instr(ng), nullInstr);
1355 } else {
1356 ASSEMBLE_BIN_OP(RRInstr(ngr), RM64Instr(ng), nullInstr);
1357 }
1363 break; 1358 break;
1364 case kS390_Or32: 1359 case kS390_Or32:
1365 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1360 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1366 ASSEMBLE_BIN_OP(ork, Or, oilf); 1361 ASSEMBLE_BIN32_OP(RRRInstr(ork), RM32Instr(Or), RIInstr(oilf));
1367 } else { 1362 } else {
1368 ASSEMBLE_BIN_OP(or_z, Or, oilf); 1363 ASSEMBLE_BIN32_OP(RRInstr(or_z), RM32Instr(Or), RIInstr(oilf));
1369 } 1364 }
1370 break; 1365 break;
1371 case kS390_Or64: 1366 case kS390_Or64:
1372 ASSEMBLE_BINOP(OrP); 1367 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1368 ASSEMBLE_BIN_OP(RRRInstr(ogrk), RM64Instr(og), nullInstr);
1369 } else {
1370 ASSEMBLE_BIN_OP(RRInstr(ogr), RM64Instr(og), nullInstr);
1371 }
1373 break; 1372 break;
1374 case kS390_Xor32: 1373 case kS390_Xor32:
1375 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1374 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1376 ASSEMBLE_BIN_OP(xrk, Xor, xilf); 1375 ASSEMBLE_BIN32_OP(RRRInstr(xrk), RM32Instr(Xor), RIInstr(xilf));
1377 } else { 1376 } else {
1378 ASSEMBLE_BIN_OP(xr, Xor, xilf); 1377 ASSEMBLE_BIN32_OP(RRInstr(xr), RM32Instr(Xor), RIInstr(xilf));
1379 } 1378 }
1380 break; 1379 break;
1381 case kS390_Xor64: 1380 case kS390_Xor64:
1382 ASSEMBLE_BINOP(XorP); 1381 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1382 ASSEMBLE_BIN_OP(RRRInstr(xgrk), RM64Instr(xg), nullInstr);
1383 } else {
1384 ASSEMBLE_BIN_OP(RRInstr(xgr), RM64Instr(xg), nullInstr);
1385 }
1383 break; 1386 break;
1384 case kS390_ShiftLeft32: 1387 case kS390_ShiftLeft32:
1385 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1388 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1386 AssembleBinOp(i, masm(), instr, &MacroAssembler::ShiftLeft, 1389 ASSEMBLE_BIN32_OP(RRRInstr(ShiftLeft), nullInstr, RRIInstr(ShiftLeft));
1387 &MacroAssembler::ShiftLeft);
1388 } else { 1390 } else {
1389 AssembleBinOp(i, masm(), instr, &MacroAssembler::sll, 1391 ASSEMBLE_BIN32_OP(RRInstr(sll), nullInstr, RIInstr(sll));
1390 &MacroAssembler::sll);
1391 } 1392 }
1392 break; 1393 break;
1393 #if V8_TARGET_ARCH_S390X
1394 case kS390_ShiftLeft64: 1394 case kS390_ShiftLeft64:
1395 ASSEMBLE_BINOP(sllg); 1395 ASSEMBLE_BIN_OP(RRRInstr(sllg), nullInstr, RRIInstr(sllg));
1396 break; 1396 break;
1397 #endif
1398 case kS390_ShiftRight32: 1397 case kS390_ShiftRight32:
1399 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1398 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1400 AssembleBinOp(i, masm(), instr, &MacroAssembler::srlk, 1399 ASSEMBLE_BIN32_OP(RRRInstr(srlk), nullInstr, RRIInstr(srlk));
1401 &MacroAssembler::srlk);
1402 } else { 1400 } else {
1403 AssembleBinOp(i, masm(), instr, &MacroAssembler::srl, 1401 ASSEMBLE_BIN32_OP(RRInstr(srl), nullInstr, RIInstr(srl));
1404 &MacroAssembler::srl);
1405 } 1402 }
1406 break; 1403 break;
1407 #if V8_TARGET_ARCH_S390X
1408 case kS390_ShiftRight64: 1404 case kS390_ShiftRight64:
1409 ASSEMBLE_BINOP(srlg); 1405 ASSEMBLE_BIN_OP(RRRInstr(srlg), nullInstr, RRIInstr(srlg));
1410 break; 1406 break;
1411 #endif
1412 case kS390_ShiftRightArith32: 1407 case kS390_ShiftRightArith32:
1413 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1408 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1414 AssembleBinOp(i, masm(), instr, &MacroAssembler::srak, 1409 ASSEMBLE_BIN32_OP(RRRInstr(srak), nullInstr, RRIInstr(srak));
1415 &MacroAssembler::srak);
1416 } else { 1410 } else {
1417 AssembleBinOp(i, masm(), instr, &MacroAssembler::sra, 1411 ASSEMBLE_BIN32_OP(RRInstr(sra), nullInstr, RIInstr(sra));
1418 &MacroAssembler::sra);
1419 } 1412 }
1420 break; 1413 break;
1421 #if V8_TARGET_ARCH_S390X
1422 case kS390_ShiftRightArith64: 1414 case kS390_ShiftRightArith64:
1423 ASSEMBLE_BINOP(srag); 1415 ASSEMBLE_BIN_OP(RRRInstr(srag), nullInstr, RRIInstr(srag));
1424 break; 1416 break;
1425 #endif
1426 #if !V8_TARGET_ARCH_S390X 1417 #if !V8_TARGET_ARCH_S390X
1427 case kS390_AddPair: 1418 case kS390_AddPair:
1428 // i.InputRegister(0) ... left low word. 1419 // i.InputRegister(0) ... left low word.
1429 // i.InputRegister(1) ... left high word. 1420 // i.InputRegister(1) ... left high word.
1430 // i.InputRegister(2) ... right low word. 1421 // i.InputRegister(2) ... right low word.
1431 // i.InputRegister(3) ... right high word. 1422 // i.InputRegister(3) ... right high word.
1432 __ AddLogical32(i.OutputRegister(0), i.InputRegister(0), 1423 __ AddLogical32(i.OutputRegister(0), i.InputRegister(0),
1433 i.InputRegister(2)); 1424 i.InputRegister(2));
1434 __ AddLogicalWithCarry32(i.OutputRegister(1), i.InputRegister(1), 1425 __ AddLogicalWithCarry32(i.OutputRegister(1), i.InputRegister(1),
1435 i.InputRegister(3)); 1426 i.InputRegister(3));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 if (HasRegisterInput(instr, 1)) { 1493 if (HasRegisterInput(instr, 1)) {
1503 __ LoadComplementRR(kScratchReg, i.InputRegister(1)); 1494 __ LoadComplementRR(kScratchReg, i.InputRegister(1));
1504 __ rll(i.OutputRegister(), i.InputRegister(0), kScratchReg); 1495 __ rll(i.OutputRegister(), i.InputRegister(0), kScratchReg);
1505 } else { 1496 } else {
1506 __ rll(i.OutputRegister(), i.InputRegister(0), 1497 __ rll(i.OutputRegister(), i.InputRegister(0),
1507 Operand(32 - i.InputInt32(1))); 1498 Operand(32 - i.InputInt32(1)));
1508 } 1499 }
1509 CHECK_AND_ZERO_EXT_OUTPUT(2); 1500 CHECK_AND_ZERO_EXT_OUTPUT(2);
1510 break; 1501 break;
1511 } 1502 }
1512 #if V8_TARGET_ARCH_S390X
1513 case kS390_RotRight64: 1503 case kS390_RotRight64:
1514 if (HasRegisterInput(instr, 1)) { 1504 if (HasRegisterInput(instr, 1)) {
1515 __ LoadComplementRR(kScratchReg, i.InputRegister(1)); 1505 __ lcgr(kScratchReg, i.InputRegister(1));
1516 __ rllg(i.OutputRegister(), i.InputRegister(0), kScratchReg); 1506 __ rllg(i.OutputRegister(), i.InputRegister(0), kScratchReg);
1517 } else { 1507 } else {
1508 DCHECK(HasImmediateInput(instr, 1));
1518 __ rllg(i.OutputRegister(), i.InputRegister(0), 1509 __ rllg(i.OutputRegister(), i.InputRegister(0),
1519 Operand(64 - i.InputInt32(1))); 1510 Operand(64 - i.InputInt32(1)));
1520 } 1511 }
1521 break; 1512 break;
1513 // TODO(john.yan): clean up kS390_RotLeftAnd...
1522 case kS390_RotLeftAndClear64: 1514 case kS390_RotLeftAndClear64:
1523 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { 1515 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) {
1524 int shiftAmount = i.InputInt32(1); 1516 int shiftAmount = i.InputInt32(1);
1525 int endBit = 63 - shiftAmount; 1517 int endBit = 63 - shiftAmount;
1526 int startBit = 63 - i.InputInt32(2); 1518 int startBit = 63 - i.InputInt32(2);
1527 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), 1519 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit),
1528 Operand(endBit), Operand(shiftAmount), true); 1520 Operand(endBit), Operand(shiftAmount), true);
1529 } else { 1521 } else {
1530 int shiftAmount = i.InputInt32(1); 1522 int shiftAmount = i.InputInt32(1);
1531 int clearBit = 63 - i.InputInt32(2); 1523 int clearBit = 63 - i.InputInt32(2);
(...skipping 27 matching lines...) Expand all
1559 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit), 1551 __ risbg(i.OutputRegister(), i.InputRegister(0), Operand(startBit),
1560 Operand(endBit), Operand(shiftAmount), true); 1552 Operand(endBit), Operand(shiftAmount), true);
1561 } else { 1553 } else {
1562 int shiftAmount = i.InputInt32(1); 1554 int shiftAmount = i.InputInt32(1);
1563 int clearBit = i.InputInt32(2); 1555 int clearBit = i.InputInt32(2);
1564 __ rllg(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount)); 1556 __ rllg(i.OutputRegister(), i.InputRegister(0), Operand(shiftAmount));
1565 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); 1557 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit));
1566 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit)); 1558 __ sllg(i.OutputRegister(), i.OutputRegister(), Operand(clearBit));
1567 } 1559 }
1568 break; 1560 break;
1569 #endif
1570 case kS390_Add32: { 1561 case kS390_Add32: {
1571 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1562 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1572 ASSEMBLE_BIN_OP(ark, Add32, Add32_RRI); 1563 ASSEMBLE_BIN32_OP(RRRInstr(ark), RM32Instr(Add32), RRIInstr(Add32));
1573 } else { 1564 } else {
1574 ASSEMBLE_BIN_OP(ar, Add32, Add32_RI); 1565 ASSEMBLE_BIN32_OP(RRInstr(ar), RM32Instr(Add32), RIInstr(Add32));
1575 } 1566 }
1576 break; 1567 break;
1577 } 1568 }
1578 case kS390_Add64: 1569 case kS390_Add64:
1579 ASSEMBLE_BINOP(AddP); 1570 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1571 ASSEMBLE_BIN_OP(RRRInstr(agrk), RM64Instr(ag), RRIInstr(AddP));
1572 } else {
1573 ASSEMBLE_BIN_OP(RRInstr(agr), RM64Instr(ag), RIInstr(agfi));
1574 }
1580 break; 1575 break;
1581 case kS390_AddFloat: 1576 case kS390_AddFloat:
1582 // Ensure we don't clobber right/InputReg(1) 1577 ASSEMBLE_BIN_OP(DDInstr(aebr), DMTInstr(AddFloat32), nullInstr);
1583 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1584 ASSEMBLE_FLOAT_UNOP(aebr);
1585 } else {
1586 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1587 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1588 __ aebr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1589 }
1590 break; 1578 break;
1591 case kS390_AddDouble: 1579 case kS390_AddDouble:
1592 // Ensure we don't clobber right/InputReg(1) 1580 ASSEMBLE_BIN_OP(DDInstr(adbr), DMTInstr(AddFloat64), nullInstr);
1593 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1594 ASSEMBLE_FLOAT_UNOP(adbr);
1595 } else {
1596 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1597 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1598 __ adbr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1599 }
1600 break; 1581 break;
1601 case kS390_Sub32: 1582 case kS390_Sub32:
1602 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 1583 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1603 ASSEMBLE_BIN_OP(srk, Sub32, Sub32_RRI); 1584 ASSEMBLE_BIN32_OP(RRRInstr(srk), RM32Instr(Sub32), RRIInstr(Sub32));
1604 } else { 1585 } else {
1605 ASSEMBLE_BIN_OP(sr, Sub32, Sub32_RI); 1586 ASSEMBLE_BIN32_OP(RRInstr(sr), RM32Instr(Sub32), RIInstr(Sub32));
1606 } 1587 }
1607 break; 1588 break;
1608 case kS390_Sub64: 1589 case kS390_Sub64:
1609 ASSEMBLE_BINOP(SubP); 1590 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
1591 ASSEMBLE_BIN_OP(RRRInstr(sgrk), RM64Instr(sg), RRIInstr(SubP));
1592 } else {
1593 ASSEMBLE_BIN_OP(RRInstr(sgr), RM64Instr(sg), RIInstr(SubP));
1594 }
1610 break; 1595 break;
1611 case kS390_SubFloat: 1596 case kS390_SubFloat:
1612 // OutputDoubleReg() = i.InputDoubleRegister(0) - i.InputDoubleRegister(1) 1597 ASSEMBLE_BIN_OP(DDInstr(sebr), DMTInstr(SubFloat32), nullInstr);
1613 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1614 __ ldr(kScratchDoubleReg, i.InputDoubleRegister(1));
1615 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1616 __ sebr(i.OutputDoubleRegister(), kScratchDoubleReg);
1617 } else {
1618 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0))) {
1619 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1620 }
1621 __ sebr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1622 }
1623 break; 1598 break;
1624 case kS390_SubDouble: 1599 case kS390_SubDouble:
1625 // OutputDoubleReg() = i.InputDoubleRegister(0) - i.InputDoubleRegister(1) 1600 ASSEMBLE_BIN_OP(DDInstr(sdbr), DMTInstr(SubFloat64), nullInstr);
1626 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1627 __ ldr(kScratchDoubleReg, i.InputDoubleRegister(1));
1628 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1629 __ sdbr(i.OutputDoubleRegister(), kScratchDoubleReg);
1630 } else {
1631 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0))) {
1632 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1633 }
1634 __ sdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1635 }
1636 break; 1601 break;
1637 case kS390_Mul32: 1602 case kS390_Mul32:
1638 ASSEMBLE_BIN_OP(Mul32, Mul32, Mul32); 1603 ASSEMBLE_BIN32_OP(RRInstr(Mul32), RM32Instr(Mul32), RIInstr(Mul32));
1639 break; 1604 break;
1640 case kS390_Mul32WithOverflow: 1605 case kS390_Mul32WithOverflow:
1641 ASSEMBLE_BIN_OP(Mul32WithOverflowIfCCUnequal, 1606 ASSEMBLE_BIN32_OP(RRRInstr(Mul32WithOverflowIfCCUnequal),
1642 Mul32WithOverflowIfCCUnequal, 1607 RRM32Instr(Mul32WithOverflowIfCCUnequal),
1643 Mul32WithOverflowIfCCUnequal); 1608 RRIInstr(Mul32WithOverflowIfCCUnequal));
1644 break; 1609 break;
1645 case kS390_Mul64: 1610 case kS390_Mul64:
1646 CHECK(i.OutputRegister().is(i.InputRegister(0))); 1611 ASSEMBLE_BIN_OP(RRInstr(Mul64), RM64Instr(Mul64), RIInstr(Mul64));
1647 if (HasRegisterInput(instr, 1)) {
1648 __ Mul64(i.InputRegister(0), i.InputRegister(1));
1649 } else if (HasImmediateInput(instr, 1)) {
1650 __ Mul64(i.InputRegister(0), i.InputImmediate(1));
1651 } else if (HasStackSlotInput(instr, 1)) {
1652 __ Mul64(i.InputRegister(0), i.InputStackSlot(1));
1653 } else {
1654 UNIMPLEMENTED();
1655 }
1656 break; 1612 break;
1657 case kS390_MulHigh32: 1613 case kS390_MulHigh32:
1658 ASSEMBLE_BIN_OP(MulHigh32, MulHigh32, MulHigh32); 1614 ASSEMBLE_BIN32_OP(RRRInstr(MulHigh32), RRM32Instr(MulHigh32),
1615 RRIInstr(MulHigh32));
1659 break; 1616 break;
1660 case kS390_MulHighU32: 1617 case kS390_MulHighU32:
1661 ASSEMBLE_BIN_OP(MulHighU32, MulHighU32, MulHighU32); 1618 ASSEMBLE_BIN32_OP(RRRInstr(MulHighU32), RRM32Instr(MulHighU32),
1619 RRIInstr(MulHighU32));
1662 break; 1620 break;
1663 case kS390_MulFloat: 1621 case kS390_MulFloat:
1664 // Ensure we don't clobber right 1622 ASSEMBLE_BIN_OP(DDInstr(meebr), DMTInstr(MulFloat32), nullInstr);
1665 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1666 ASSEMBLE_FLOAT_UNOP(meebr);
1667 } else {
1668 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1669 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1670 __ meebr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1671 }
1672 break; 1623 break;
1673 case kS390_MulDouble: 1624 case kS390_MulDouble:
1674 // Ensure we don't clobber right 1625 ASSEMBLE_BIN_OP(DDInstr(mdbr), DMTInstr(MulFloat64), nullInstr);
1675 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1676 ASSEMBLE_FLOAT_UNOP(mdbr);
1677 } else {
1678 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1679 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1680 __ mdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1681 }
1682 break; 1626 break;
1683 #if V8_TARGET_ARCH_S390X
1684 case kS390_Div64: 1627 case kS390_Div64:
1685 __ LoadRR(r1, i.InputRegister(0)); 1628 ASSEMBLE_BIN_OP(RRRInstr(Div64), RRM64Instr(Div64), nullInstr);
1686 __ dsgr(r0, i.InputRegister(1)); // R1: Dividend
1687 __ ltgr(i.OutputRegister(), r1); // Copy R1: Quotient to output
1688 break; 1629 break;
1689 #endif
1690 case kS390_Div32: { 1630 case kS390_Div32: {
1691 ASSEMBLE_BIN_OP(Div32, Div32, Div32); 1631 ASSEMBLE_BIN32_OP(RRRInstr(Div32), RRM32Instr(Div32), nullInstr);
1692 break; 1632 break;
1693 } 1633 }
1694 #if V8_TARGET_ARCH_S390X
1695 case kS390_DivU64: 1634 case kS390_DivU64:
1696 __ LoadRR(r1, i.InputRegister(0)); 1635 ASSEMBLE_BIN_OP(RRRInstr(DivU64), RRM64Instr(DivU64), nullInstr);
1697 __ LoadImmP(r0, Operand::Zero());
1698 __ dlgr(r0, i.InputRegister(1)); // R0:R1: Dividend
1699 __ ltgr(i.OutputRegister(), r1); // Copy R1: Quotient to output
1700 break; 1636 break;
1701 #endif
1702 case kS390_DivU32: { 1637 case kS390_DivU32: {
1703 ASSEMBLE_BIN_OP(DivU32, DivU32, DivU32); 1638 ASSEMBLE_BIN32_OP(RRRInstr(DivU32), RRM32Instr(DivU32), nullInstr);
1704 break; 1639 break;
1705 } 1640 }
1706 case kS390_DivFloat: 1641 case kS390_DivFloat:
1707 // InputDoubleRegister(1)=InputDoubleRegister(0)/InputDoubleRegister(1) 1642 ASSEMBLE_BIN_OP(DDInstr(debr), DMTInstr(DivFloat32), nullInstr);
1708 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1709 __ ldr(kScratchDoubleReg, i.InputDoubleRegister(1));
1710 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1711 __ debr(i.OutputDoubleRegister(), kScratchDoubleReg);
1712 } else {
1713 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1714 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1715 __ debr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1716 }
1717 break; 1643 break;
1718 case kS390_DivDouble: 1644 case kS390_DivDouble:
1719 // InputDoubleRegister(1)=InputDoubleRegister(0)/InputDoubleRegister(1) 1645 ASSEMBLE_BIN_OP(DDInstr(ddbr), DMTInstr(DivFloat64), nullInstr);
1720 if (i.OutputDoubleRegister().is(i.InputDoubleRegister(1))) {
1721 __ ldr(kScratchDoubleReg, i.InputDoubleRegister(1));
1722 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1723 __ ddbr(i.OutputDoubleRegister(), kScratchDoubleReg);
1724 } else {
1725 if (!i.OutputDoubleRegister().is(i.InputDoubleRegister(0)))
1726 __ ldr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1727 __ ddbr(i.OutputDoubleRegister(), i.InputDoubleRegister(1));
1728 }
1729 break; 1646 break;
1730 case kS390_Mod32: 1647 case kS390_Mod32:
1731 ASSEMBLE_BIN_OP(Mod32, Mod32, Mod32); 1648 ASSEMBLE_BIN32_OP(RRRInstr(Mod32), RRM32Instr(Mod32), nullInstr);
1732 break; 1649 break;
1733 case kS390_ModU32: 1650 case kS390_ModU32:
1734 ASSEMBLE_BIN_OP(ModU32, ModU32, ModU32); 1651 ASSEMBLE_BIN32_OP(RRRInstr(ModU32), RRM32Instr(ModU32), nullInstr);
1735 break; 1652 break;
1736 #if V8_TARGET_ARCH_S390X
1737 case kS390_Mod64: 1653 case kS390_Mod64:
1738 __ LoadRR(r1, i.InputRegister(0)); 1654 ASSEMBLE_BIN_OP(RRRInstr(Mod64), RRM64Instr(Mod64), nullInstr);
1739 __ dsgr(r0, i.InputRegister(1)); // R1: Dividend
1740 __ ltgr(i.OutputRegister(), r0); // Copy R0: Remainder to output
1741 break; 1655 break;
1742 case kS390_ModU64: 1656 case kS390_ModU64:
1743 __ LoadRR(r1, i.InputRegister(0)); 1657 ASSEMBLE_BIN_OP(RRRInstr(ModU64), RRM64Instr(ModU64), nullInstr);
1744 __ LoadImmP(r0, Operand::Zero());
1745 __ dlgr(r0, i.InputRegister(1)); // R0:R1: Dividend
1746 __ ltgr(i.OutputRegister(), r0); // Copy R0: Remainder to output
1747 break; 1658 break;
1748 #endif
1749 case kS390_AbsFloat: 1659 case kS390_AbsFloat:
1750 __ lpebr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 1660 __ lpebr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1751 break; 1661 break;
1752 case kS390_SqrtFloat: 1662 case kS390_SqrtFloat:
1753 ASSEMBLE_FLOAT_UNOP(sqebr); 1663 ASSEMBLE_UNARY_OP(D_DInstr(sqebr), nullInstr, nullInstr);
1664 break;
1665 case kS390_SqrtDouble:
1666 ASSEMBLE_UNARY_OP(D_DInstr(sqdbr), nullInstr, nullInstr);
1754 break; 1667 break;
1755 case kS390_FloorFloat: 1668 case kS390_FloorFloat:
1756 __ fiebra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1669 __ fiebra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1757 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF); 1670 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF);
1758 break; 1671 break;
1759 case kS390_CeilFloat: 1672 case kS390_CeilFloat:
1760 __ fiebra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1673 __ fiebra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1761 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF); 1674 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF);
1762 break; 1675 break;
1763 case kS390_TruncateFloat: 1676 case kS390_TruncateFloat:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 break; 1762 break;
1850 case kS390_MinFloat: 1763 case kS390_MinFloat:
1851 ASSEMBLE_FLOAT_MIN(); 1764 ASSEMBLE_FLOAT_MIN();
1852 break; 1765 break;
1853 case kS390_MinDouble: 1766 case kS390_MinDouble:
1854 ASSEMBLE_DOUBLE_MIN(); 1767 ASSEMBLE_DOUBLE_MIN();
1855 break; 1768 break;
1856 case kS390_AbsDouble: 1769 case kS390_AbsDouble:
1857 __ lpdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 1770 __ lpdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
1858 break; 1771 break;
1859 case kS390_SqrtDouble:
1860 ASSEMBLE_FLOAT_UNOP(sqdbr);
1861 break;
1862 case kS390_FloorDouble: 1772 case kS390_FloorDouble:
1863 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1773 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1864 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF); 1774 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF);
1865 break; 1775 break;
1866 case kS390_CeilDouble: 1776 case kS390_CeilDouble:
1867 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1777 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1868 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF); 1778 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF);
1869 break; 1779 break;
1870 case kS390_TruncateDouble: 1780 case kS390_TruncateDouble:
1871 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1781 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1872 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0); 1782 v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0);
1873 break; 1783 break;
1874 case kS390_RoundDouble: 1784 case kS390_RoundDouble:
1875 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1785 __ fidbra(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1876 v8::internal::Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0); 1786 v8::internal::Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0);
1877 break; 1787 break;
1878 case kS390_NegFloat: 1788 case kS390_NegFloat:
1879 ASSEMBLE_FLOAT_UNOP(lcebr); 1789 ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr);
1880 break; 1790 break;
1881 case kS390_NegDouble: 1791 case kS390_NegDouble:
1882 ASSEMBLE_FLOAT_UNOP(lcdbr); 1792 ASSEMBLE_UNARY_OP(D_DInstr(lcdbr), nullInstr, nullInstr);
1883 break; 1793 break;
1884 case kS390_Cntlz32: { 1794 case kS390_Cntlz32: {
1885 __ llgfr(i.OutputRegister(), i.InputRegister(0)); 1795 __ llgfr(i.OutputRegister(), i.InputRegister(0));
1886 __ flogr(r0, i.OutputRegister()); 1796 __ flogr(r0, i.OutputRegister());
1887 __ Add32(i.OutputRegister(), r0, Operand(-32)); 1797 __ Add32(i.OutputRegister(), r0, Operand(-32));
1888 // No need to zero-ext b/c llgfr is done already 1798 // No need to zero-ext b/c llgfr is done already
1889 break; 1799 break;
1890 } 1800 }
1891 #if V8_TARGET_ARCH_S390X 1801 #if V8_TARGET_ARCH_S390X
1892 case kS390_Cntlz64: { 1802 case kS390_Cntlz64: {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 Label conversion_done; 2047 Label conversion_done;
2138 __ LoadImmP(i.OutputRegister(1), Operand::Zero()); 2048 __ LoadImmP(i.OutputRegister(1), Operand::Zero());
2139 __ b(Condition(1), &conversion_done); // special case 2049 __ b(Condition(1), &conversion_done); // special case
2140 __ LoadImmP(i.OutputRegister(1), Operand(1)); 2050 __ LoadImmP(i.OutputRegister(1), Operand(1));
2141 __ bind(&conversion_done); 2051 __ bind(&conversion_done);
2142 } 2052 }
2143 break; 2053 break;
2144 } 2054 }
2145 #endif 2055 #endif
2146 case kS390_DoubleToFloat32: 2056 case kS390_DoubleToFloat32:
2147 __ ledbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 2057 ASSEMBLE_UNARY_OP(D_DInstr(ledbr), nullInstr, nullInstr);
2148 break; 2058 break;
2149 case kS390_Float32ToDouble: 2059 case kS390_Float32ToDouble:
2150 __ ldebr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); 2060 ASSEMBLE_UNARY_OP(D_DInstr(ldebr), D_MTInstr(LoadFloat32ToDouble),
2061 nullInstr);
2151 break; 2062 break;
2152 case kS390_DoubleExtractLowWord32: 2063 case kS390_DoubleExtractLowWord32:
2153 __ lgdr(i.OutputRegister(), i.InputDoubleRegister(0)); 2064 __ lgdr(i.OutputRegister(), i.InputDoubleRegister(0));
2154 __ llgfr(i.OutputRegister(), i.OutputRegister()); 2065 __ llgfr(i.OutputRegister(), i.OutputRegister());
2155 break; 2066 break;
2156 case kS390_DoubleExtractHighWord32: 2067 case kS390_DoubleExtractHighWord32:
2157 __ lgdr(i.OutputRegister(), i.InputDoubleRegister(0)); 2068 __ lgdr(i.OutputRegister(), i.InputDoubleRegister(0));
2158 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(32)); 2069 __ srlg(i.OutputRegister(), i.OutputRegister(), Operand(32));
2159 break; 2070 break;
2160 case kS390_DoubleInsertLowWord32: 2071 case kS390_DoubleInsertLowWord32:
2161 __ lgdr(kScratchReg, i.OutputDoubleRegister()); 2072 __ lgdr(kScratchReg, i.OutputDoubleRegister());
2162 __ lr(kScratchReg, i.InputRegister(1)); 2073 __ lr(kScratchReg, i.InputRegister(1));
2163 __ ldgr(i.OutputDoubleRegister(), kScratchReg); 2074 __ ldgr(i.OutputDoubleRegister(), kScratchReg);
2164 break; 2075 break;
2165 case kS390_DoubleInsertHighWord32: 2076 case kS390_DoubleInsertHighWord32:
2166 __ sllg(kScratchReg, i.InputRegister(1), Operand(32)); 2077 __ sllg(kScratchReg, i.InputRegister(1), Operand(32));
2167 __ lgdr(r0, i.OutputDoubleRegister()); 2078 __ lgdr(r0, i.OutputDoubleRegister());
2168 __ lr(kScratchReg, r0); 2079 __ lr(kScratchReg, r0);
2169 __ ldgr(i.OutputDoubleRegister(), kScratchReg); 2080 __ ldgr(i.OutputDoubleRegister(), kScratchReg);
2170 break; 2081 break;
2171 case kS390_DoubleConstruct: 2082 case kS390_DoubleConstruct:
2172 __ sllg(kScratchReg, i.InputRegister(0), Operand(32)); 2083 __ sllg(kScratchReg, i.InputRegister(0), Operand(32));
2173 __ lr(kScratchReg, i.InputRegister(1)); 2084 __ lr(kScratchReg, i.InputRegister(1));
2174 2085
2175 // Bitwise convert from GPR to FPR 2086 // Bitwise convert from GPR to FPR
2176 __ ldgr(i.OutputDoubleRegister(), kScratchReg); 2087 __ ldgr(i.OutputDoubleRegister(), kScratchReg);
2177 break; 2088 break;
2178 case kS390_LoadWordS8: 2089 case kS390_LoadWordS8:
2179 ASSEMBLE_LOAD_INTEGER(LoadlB); 2090 ASSEMBLE_LOAD_INTEGER(LoadB);
2180 #if V8_TARGET_ARCH_S390X
2181 __ lgbr(i.OutputRegister(), i.OutputRegister());
2182 #else
2183 __ lbr(i.OutputRegister(), i.OutputRegister());
2184 #endif
2185 break; 2091 break;
2186 case kS390_BitcastFloat32ToInt32: 2092 case kS390_BitcastFloat32ToInt32:
2187 __ MovFloatToInt(i.OutputRegister(), i.InputDoubleRegister(0)); 2093 ASSEMBLE_UNARY_OP(R_DInstr(MovFloatToInt), R_MInstr(LoadlW), nullInstr);
2188 break; 2094 break;
2189 case kS390_BitcastInt32ToFloat32: 2095 case kS390_BitcastInt32ToFloat32:
2190 __ MovIntToFloat(i.OutputDoubleRegister(), i.InputRegister(0)); 2096 __ MovIntToFloat(i.OutputDoubleRegister(), i.InputRegister(0));
2191 break; 2097 break;
2192 #if V8_TARGET_ARCH_S390X 2098 #if V8_TARGET_ARCH_S390X
2193 case kS390_BitcastDoubleToInt64: 2099 case kS390_BitcastDoubleToInt64:
2194 __ MovDoubleToInt64(i.OutputRegister(), i.InputDoubleRegister(0)); 2100 __ MovDoubleToInt64(i.OutputRegister(), i.InputDoubleRegister(0));
2195 break; 2101 break;
2196 case kS390_BitcastInt64ToDouble: 2102 case kS390_BitcastInt64ToDouble:
2197 __ MovInt64ToDouble(i.OutputDoubleRegister(), i.InputRegister(0)); 2103 __ MovInt64ToDouble(i.OutputDoubleRegister(), i.InputRegister(0));
(...skipping 26 matching lines...) Expand all
2224 case kS390_LoadReverse16RR: 2130 case kS390_LoadReverse16RR:
2225 __ lrvr(i.OutputRegister(), i.InputRegister(0)); 2131 __ lrvr(i.OutputRegister(), i.InputRegister(0));
2226 __ rll(i.OutputRegister(), i.OutputRegister(), Operand(16)); 2132 __ rll(i.OutputRegister(), i.OutputRegister(), Operand(16));
2227 break; 2133 break;
2228 case kS390_LoadReverse32RR: 2134 case kS390_LoadReverse32RR:
2229 __ lrvr(i.OutputRegister(), i.InputRegister(0)); 2135 __ lrvr(i.OutputRegister(), i.InputRegister(0));
2230 break; 2136 break;
2231 case kS390_LoadReverse64RR: 2137 case kS390_LoadReverse64RR:
2232 __ lrvgr(i.OutputRegister(), i.InputRegister(0)); 2138 __ lrvgr(i.OutputRegister(), i.InputRegister(0));
2233 break; 2139 break;
2234 #if V8_TARGET_ARCH_S390X
2235 case kS390_LoadWord64: 2140 case kS390_LoadWord64:
2236 ASSEMBLE_LOAD_INTEGER(lg); 2141 ASSEMBLE_LOAD_INTEGER(lg);
2237 break; 2142 break;
2238 #endif
2239 case kS390_LoadAndTestWord32: { 2143 case kS390_LoadAndTestWord32: {
2240 ASSEMBLE_LOADANDTEST32(ltr, lt_z); 2144 ASSEMBLE_LOADANDTEST32(ltr, lt_z);
2241 break; 2145 break;
2242 } 2146 }
2243 case kS390_LoadAndTestWord64: { 2147 case kS390_LoadAndTestWord64: {
2244 ASSEMBLE_LOADANDTEST64(ltgr, ltg); 2148 ASSEMBLE_LOADANDTEST64(ltgr, ltg);
2245 break; 2149 break;
2246 } 2150 }
2247 case kS390_LoadFloat32: 2151 case kS390_LoadFloat32:
2248 ASSEMBLE_LOAD_FLOAT(LoadFloat32); 2152 ASSEMBLE_LOAD_FLOAT(LoadFloat32);
(...skipping 27 matching lines...) Expand all
2276 case kS390_StoreFloat32: 2180 case kS390_StoreFloat32:
2277 ASSEMBLE_STORE_FLOAT32(); 2181 ASSEMBLE_STORE_FLOAT32();
2278 break; 2182 break;
2279 case kS390_StoreDouble: 2183 case kS390_StoreDouble:
2280 ASSEMBLE_STORE_DOUBLE(); 2184 ASSEMBLE_STORE_DOUBLE();
2281 break; 2185 break;
2282 case kS390_Lay: 2186 case kS390_Lay:
2283 __ lay(i.OutputRegister(), i.MemoryOperand()); 2187 __ lay(i.OutputRegister(), i.MemoryOperand());
2284 break; 2188 break;
2285 case kCheckedLoadInt8: 2189 case kCheckedLoadInt8:
2286 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadlB); 2190 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadB);
2287 #if V8_TARGET_ARCH_S390X
2288 __ lgbr(i.OutputRegister(), i.OutputRegister());
2289 #else
2290 __ lbr(i.OutputRegister(), i.OutputRegister());
2291 #endif
2292 break; 2191 break;
2293 case kCheckedLoadUint8: 2192 case kCheckedLoadUint8:
2294 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadlB); 2193 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadlB);
2295 break; 2194 break;
2296 case kCheckedLoadInt16: 2195 case kCheckedLoadInt16:
2297 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadHalfWordP); 2196 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadHalfWordP);
2298 break; 2197 break;
2299 case kCheckedLoadUint16: 2198 case kCheckedLoadUint16:
2300 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadLogicalHalfWordP); 2199 ASSEMBLE_CHECKED_LOAD_INTEGER(LoadLogicalHalfWordP);
2301 break; 2200 break;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 // last output of the instruction. 2387 // last output of the instruction.
2489 DCHECK_NE(0u, instr->OutputCount()); 2388 DCHECK_NE(0u, instr->OutputCount());
2490 Register reg = i.OutputRegister(instr->OutputCount() - 1); 2389 Register reg = i.OutputRegister(instr->OutputCount() - 1);
2491 Condition cond = FlagsConditionToCondition(condition, op); 2390 Condition cond = FlagsConditionToCondition(condition, op);
2492 Label done; 2391 Label done;
2493 if (check_unordered) { 2392 if (check_unordered) {
2494 __ LoadImmP(reg, (cond == eq || cond == le || cond == lt) ? Operand::Zero() 2393 __ LoadImmP(reg, (cond == eq || cond == le || cond == lt) ? Operand::Zero()
2495 : Operand(1)); 2394 : Operand(1));
2496 __ bunordered(&done); 2395 __ bunordered(&done);
2497 } 2396 }
2397
2398 // TODO(john.yan): use load imm high on condition here
2498 __ LoadImmP(reg, Operand::Zero()); 2399 __ LoadImmP(reg, Operand::Zero());
2499 __ LoadImmP(kScratchReg, Operand(1)); 2400 __ LoadImmP(kScratchReg, Operand(1));
2500 // locr is sufficient since reg's upper 32 is guarrantee to be 0 2401 // locr is sufficient since reg's upper 32 is guarrantee to be 0
2501 __ locr(cond, reg, kScratchReg); 2402 __ locr(cond, reg, kScratchReg);
2502 __ bind(&done); 2403 __ bind(&done);
2503 } 2404 }
2504 2405
2505 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { 2406 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) {
2506 S390OperandConverter i(this, instr); 2407 S390OperandConverter i(this, instr);
2507 Register input = i.InputRegister(0); 2408 Register input = i.InputRegister(0);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 padding_size -= 2; 2798 padding_size -= 2;
2898 } 2799 }
2899 } 2800 }
2900 } 2801 }
2901 2802
2902 #undef __ 2803 #undef __
2903 2804
2904 } // namespace compiler 2805 } // namespace compiler
2905 } // namespace internal 2806 } // namespace internal
2906 } // namespace v8 2807 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/s390/instruction-selector-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698