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

Side by Side Diff: src/crankshaft/s390/lithium-codegen-s390.cc

Issue 2591643005: S390 [Crankshaft]: Use LoadPositive for MathAbs (Closed)
Patch Set: Fix for John's comment Created 3 years, 12 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/s390/assembler-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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" 6 #include "src/crankshaft/s390/lithium-codegen-s390.h"
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 3380
3381 __ StoreToSafepointRegisterSlot(tmp1, result); 3381 __ StoreToSafepointRegisterSlot(tmp1, result);
3382 } 3382 }
3383 3383
3384 __ bind(&done); 3384 __ bind(&done);
3385 } 3385 }
3386 3386
3387 void LCodeGen::EmitMathAbs(LMathAbs* instr) { 3387 void LCodeGen::EmitMathAbs(LMathAbs* instr) {
3388 Register input = ToRegister(instr->value()); 3388 Register input = ToRegister(instr->value());
3389 Register result = ToRegister(instr->result()); 3389 Register result = ToRegister(instr->result());
3390 Label done; 3390 __ LoadPositiveP(result, input);
3391 __ CmpP(input, Operand::Zero());
3392 __ Move(result, input);
3393 __ bge(&done, Label::kNear);
3394 __ LoadComplementRR(result, result);
3395 // Deoptimize on overflow. 3391 // Deoptimize on overflow.
3396 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow, cr0); 3392 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow, cr0);
3397 __ bind(&done);
3398 } 3393 }
3399 3394
3400 #if V8_TARGET_ARCH_S390X 3395 #if V8_TARGET_ARCH_S390X
3401 void LCodeGen::EmitInteger32MathAbs(LMathAbs* instr) { 3396 void LCodeGen::EmitInteger32MathAbs(LMathAbs* instr) {
3402 Register input = ToRegister(instr->value()); 3397 Register input = ToRegister(instr->value());
3403 Register result = ToRegister(instr->result()); 3398 Register result = ToRegister(instr->result());
3404 Label done; 3399 __ LoadPositive32(result, input);
john.yan 2016/12/21 21:03:52 maybe more lgfr to here instead of putting in Macr
3405 __ Cmp32(input, Operand::Zero()); 3400 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow);
3406 __ Move(result, input);
3407 __ bge(&done, Label::kNear);
3408
3409 // Deoptimize on overflow.
3410 __ Cmp32(input, Operand(0x80000000));
3411 DeoptimizeIf(eq, instr, DeoptimizeReason::kOverflow);
3412
3413 __ LoadComplementRR(result, result);
3414 __ bind(&done);
3415 } 3401 }
3416 #endif 3402 #endif
3417 3403
3418 void LCodeGen::DoMathAbs(LMathAbs* instr) { 3404 void LCodeGen::DoMathAbs(LMathAbs* instr) {
3419 // Class for deferred case. 3405 // Class for deferred case.
3420 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { 3406 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode {
3421 public: 3407 public:
3422 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) 3408 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr)
3423 : LDeferredCode(codegen), instr_(instr) {} 3409 : LDeferredCode(codegen), instr_(instr) {}
3424 void Generate() override { 3410 void Generate() override {
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
5585 __ LoadP(result, 5571 __ LoadP(result,
5586 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); 5572 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize));
5587 __ bind(deferred->exit()); 5573 __ bind(deferred->exit());
5588 __ bind(&done); 5574 __ bind(&done);
5589 } 5575 }
5590 5576
5591 #undef __ 5577 #undef __
5592 5578
5593 } // namespace internal 5579 } // namespace internal
5594 } // namespace v8 5580 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/s390/assembler-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698