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

Side by Side Diff: src/s390/macro-assembler-s390.cc

Issue 2611773003: s390: Optimize LoadDoubleLiteral (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | 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 // 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 <assert.h> // For assert 5 #include <assert.h> // For assert
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_S390 8 #if V8_TARGET_ARCH_S390
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 4316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4327 llilf(dst, Operand(value)); 4327 llilf(dst, Operand(value));
4328 #endif 4328 #endif
4329 } 4329 }
4330 4330
4331 void MacroAssembler::LoadDoubleLiteral(DoubleRegister result, uint64_t value, 4331 void MacroAssembler::LoadDoubleLiteral(DoubleRegister result, uint64_t value,
4332 Register scratch) { 4332 Register scratch) {
4333 uint32_t hi_32 = value >> 32; 4333 uint32_t hi_32 = value >> 32;
4334 uint32_t lo_32 = static_cast<uint32_t>(value); 4334 uint32_t lo_32 = static_cast<uint32_t>(value);
4335 4335
4336 // Load the 64-bit value into a GPR, then transfer it to FPR via LDGR 4336 // Load the 64-bit value into a GPR, then transfer it to FPR via LDGR
4337 iihf(scratch, Operand(hi_32)); 4337 if (value == 0) {
4338 iilf(scratch, Operand(lo_32)); 4338 lzdr(result);
4339 ldgr(result, scratch); 4339 } else if (lo_32 == 0) {
4340 llihf(scratch, Operand(hi_32));
4341 ldgr(result, scratch);
4342 } else {
4343 iihf(scratch, Operand(hi_32));
4344 iilf(scratch, Operand(lo_32));
4345 ldgr(result, scratch);
4346 }
4340 } 4347 }
4341 4348
4342 void MacroAssembler::LoadDoubleLiteral(DoubleRegister result, double value, 4349 void MacroAssembler::LoadDoubleLiteral(DoubleRegister result, double value,
4343 Register scratch) { 4350 Register scratch) {
4344 uint64_t int_val = bit_cast<uint64_t, double>(value); 4351 uint64_t int_val = bit_cast<uint64_t, double>(value);
4345 LoadDoubleLiteral(result, int_val, scratch); 4352 LoadDoubleLiteral(result, int_val, scratch);
4346 } 4353 }
4347 4354
4348 void MacroAssembler::LoadFloat32Literal(DoubleRegister result, float value, 4355 void MacroAssembler::LoadFloat32Literal(DoubleRegister result, float value,
4349 Register scratch) { 4356 Register scratch) {
4350 uint32_t hi_32 = bit_cast<uint32_t>(value); 4357 uint64_t int_val = static_cast<uint64_t>(bit_cast<uint32_t, float>(value))
4351 uint32_t lo_32 = 0; 4358 << 32;
4352 4359 LoadDoubleLiteral(result, int_val, scratch);
4353 // Load the 64-bit value into a GPR, then transfer it to FPR via LDGR
4354 iihf(scratch, Operand(hi_32));
4355 iilf(scratch, Operand(lo_32));
4356 ldgr(result, scratch);
4357 } 4360 }
4358 4361
4359 void MacroAssembler::CmpSmiLiteral(Register src1, Smi* smi, Register scratch) { 4362 void MacroAssembler::CmpSmiLiteral(Register src1, Smi* smi, Register scratch) {
4360 #if V8_TARGET_ARCH_S390X 4363 #if V8_TARGET_ARCH_S390X
4361 if (CpuFeatures::IsSupported(DISTINCT_OPS)) { 4364 if (CpuFeatures::IsSupported(DISTINCT_OPS)) {
4362 cih(src1, Operand(reinterpret_cast<intptr_t>(smi) >> 32)); 4365 cih(src1, Operand(reinterpret_cast<intptr_t>(smi) >> 32));
4363 } else { 4366 } else {
4364 LoadSmiLiteral(scratch, smi); 4367 LoadSmiLiteral(scratch, smi);
4365 cgr(src1, scratch); 4368 cgr(src1, scratch);
4366 } 4369 }
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 } 5130 }
5128 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); 5131 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift));
5129 ExtractBit(r0, dividend, 31); 5132 ExtractBit(r0, dividend, 31);
5130 AddP(result, r0); 5133 AddP(result, r0);
5131 } 5134 }
5132 5135
5133 } // namespace internal 5136 } // namespace internal
5134 } // namespace v8 5137 } // namespace v8
5135 5138
5136 #endif // V8_TARGET_ARCH_S390 5139 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698