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

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

Issue 172133003: Harmony: optimize Math.clz32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/ia32/lithium-ia32.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4116 __ movsd(Operand(esp, 0), input_reg); 4116 __ movsd(Operand(esp, 0), input_reg);
4117 __ fld_d(Operand(esp, 0)); 4117 __ fld_d(Operand(esp, 0));
4118 __ fyl2x(); 4118 __ fyl2x();
4119 __ fstp_d(Operand(esp, 0)); 4119 __ fstp_d(Operand(esp, 0));
4120 __ movsd(input_reg, Operand(esp, 0)); 4120 __ movsd(input_reg, Operand(esp, 0));
4121 __ add(Operand(esp), Immediate(kDoubleSize)); 4121 __ add(Operand(esp), Immediate(kDoubleSize));
4122 __ bind(&done); 4122 __ bind(&done);
4123 } 4123 }
4124 4124
4125 4125
4126 void LCodeGen::DoMathClz32(LMathClz32* instr) {
4127 CpuFeatureScope scope(masm(), SSE2);
4128 Register input = ToRegister(instr->value());
4129 Register result = ToRegister(instr->result());
4130 Label not_zero_input;
4131 __ bsr(result, input);
4132
4133 __ j(not_zero, &not_zero_input);
4134 __ Set(result, Immediate(63)); // 63^31 == 32
4135
4136 __ bind(&not_zero_input);
4137 __ xor_(result, Immediate(31)); // for x in [0..31], 31^x == 31-x.
4138 }
4139
4140
4126 void LCodeGen::DoMathExp(LMathExp* instr) { 4141 void LCodeGen::DoMathExp(LMathExp* instr) {
4127 CpuFeatureScope scope(masm(), SSE2); 4142 CpuFeatureScope scope(masm(), SSE2);
4128 XMMRegister input = ToDoubleRegister(instr->value()); 4143 XMMRegister input = ToDoubleRegister(instr->value());
4129 XMMRegister result = ToDoubleRegister(instr->result()); 4144 XMMRegister result = ToDoubleRegister(instr->result());
4130 XMMRegister temp0 = double_scratch0(); 4145 XMMRegister temp0 = double_scratch0();
4131 Register temp1 = ToRegister(instr->temp1()); 4146 Register temp1 = ToRegister(instr->temp1());
4132 Register temp2 = ToRegister(instr->temp2()); 4147 Register temp2 = ToRegister(instr->temp2());
4133 4148
4134 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2); 4149 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2);
4135 } 4150 }
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
6255 FixedArray::kHeaderSize - kPointerSize)); 6270 FixedArray::kHeaderSize - kPointerSize));
6256 __ bind(&done); 6271 __ bind(&done);
6257 } 6272 }
6258 6273
6259 6274
6260 #undef __ 6275 #undef __
6261 6276
6262 } } // namespace v8::internal 6277 } } // namespace v8::internal
6263 6278
6264 #endif // V8_TARGET_ARCH_IA32 6279 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698