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

Side by Side Diff: src/x87/lithium-codegen-x87.cc

Issue 1022523005: X87: [turbofan] Turn Math.clz32 into an inlinable builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/x87/macro-assembler-x87.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 4276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4287 __ fld_d(Operand::StaticVariable(ninf)); 4287 __ fld_d(Operand::StaticVariable(ninf));
4288 X87CommitWrite(input_reg); 4288 X87CommitWrite(input_reg);
4289 4289
4290 __ bind(&done); 4290 __ bind(&done);
4291 } 4291 }
4292 4292
4293 4293
4294 void LCodeGen::DoMathClz32(LMathClz32* instr) { 4294 void LCodeGen::DoMathClz32(LMathClz32* instr) {
4295 Register input = ToRegister(instr->value()); 4295 Register input = ToRegister(instr->value());
4296 Register result = ToRegister(instr->result()); 4296 Register result = ToRegister(instr->result());
4297 Label not_zero_input;
4298 __ bsr(result, input);
4299 4297
4300 __ j(not_zero, &not_zero_input); 4298 __ Lzcnt(result, input);
4301 __ Move(result, Immediate(63)); // 63^31 == 32
4302
4303 __ bind(&not_zero_input);
4304 __ xor_(result, Immediate(31)); // for x in [0..31], 31^x == 31-x.
4305 } 4299 }
4306 4300
4307 4301
4308 void LCodeGen::DoMathExp(LMathExp* instr) { 4302 void LCodeGen::DoMathExp(LMathExp* instr) {
4309 X87Register input = ToX87Register(instr->value()); 4303 X87Register input = ToX87Register(instr->value());
4310 X87Register result_reg = ToX87Register(instr->result()); 4304 X87Register result_reg = ToX87Register(instr->result());
4311 Register temp_result = ToRegister(instr->temp1()); 4305 Register temp_result = ToRegister(instr->temp1());
4312 Register temp = ToRegister(instr->temp2()); 4306 Register temp = ToRegister(instr->temp2());
4313 Label slow, done, smi, finish; 4307 Label slow, done, smi, finish;
4314 DCHECK(result_reg.is(input)); 4308 DCHECK(result_reg.is(input));
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
6413 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6407 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6414 RecordSafepoint(Safepoint::kNoLazyDeopt); 6408 RecordSafepoint(Safepoint::kNoLazyDeopt);
6415 } 6409 }
6416 6410
6417 6411
6418 #undef __ 6412 #undef __
6419 6413
6420 } } // namespace v8::internal 6414 } } // namespace v8::internal
6421 6415
6422 #endif // V8_TARGET_ARCH_X87 6416 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698