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/compiler/x64/code-generator-x64.cc

Issue 662813002: IA: Double arithmetic binops support memory operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } else { \ 195 } else { \
196 if (instr->Output()->IsRegister()) { \ 196 if (instr->Output()->IsRegister()) { \
197 __ asm_instr##_cl(i.OutputRegister()); \ 197 __ asm_instr##_cl(i.OutputRegister()); \
198 } else { \ 198 } else { \
199 __ asm_instr##_cl(i.OutputOperand()); \ 199 __ asm_instr##_cl(i.OutputOperand()); \
200 } \ 200 } \
201 } \ 201 } \
202 } while (0) 202 } while (0)
203 203
204 204
205 #define ASSEMBLE_DOUBLE_BINOP(asm_instr) \
206 do { \
207 if (instr->InputAt(1)->IsDoubleRegister()) { \
208 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \
209 } else { \
210 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \
211 } \
212 } while (0)
213
214
205 // Assembles an instruction after register allocation, producing machine code. 215 // Assembles an instruction after register allocation, producing machine code.
206 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { 216 void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
207 X64OperandConverter i(this, instr); 217 X64OperandConverter i(this, instr);
208 218
209 switch (ArchOpcodeField::decode(instr->opcode())) { 219 switch (ArchOpcodeField::decode(instr->opcode())) {
210 case kArchCallCodeObject: { 220 case kArchCallCodeObject: {
211 EnsureSpaceForLazyDeopt(); 221 EnsureSpaceForLazyDeopt();
212 if (HasImmediateInput(instr, 0)) { 222 if (HasImmediateInput(instr, 0)) {
213 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); 223 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
214 __ Call(code, RelocInfo::CODE_TARGET); 224 __ Call(code, RelocInfo::CODE_TARGET);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 case kX64Sar: 354 case kX64Sar:
345 ASSEMBLE_SHIFT(sarq, 6); 355 ASSEMBLE_SHIFT(sarq, 6);
346 break; 356 break;
347 case kX64Ror32: 357 case kX64Ror32:
348 ASSEMBLE_SHIFT(rorl, 5); 358 ASSEMBLE_SHIFT(rorl, 5);
349 break; 359 break;
350 case kX64Ror: 360 case kX64Ror:
351 ASSEMBLE_SHIFT(rorq, 6); 361 ASSEMBLE_SHIFT(rorq, 6);
352 break; 362 break;
353 case kSSEFloat64Cmp: 363 case kSSEFloat64Cmp:
354 if (instr->InputAt(1)->IsDoubleRegister()) { 364 ASSEMBLE_DOUBLE_BINOP(ucomisd);
355 __ ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
356 } else {
357 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
358 }
359 break; 365 break;
360 case kSSEFloat64Add: 366 case kSSEFloat64Add:
361 __ addsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 367 ASSEMBLE_DOUBLE_BINOP(addsd);
362 break; 368 break;
363 case kSSEFloat64Sub: 369 case kSSEFloat64Sub:
364 __ subsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 370 ASSEMBLE_DOUBLE_BINOP(subsd);
365 break; 371 break;
366 case kSSEFloat64Mul: 372 case kSSEFloat64Mul:
367 __ mulsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 373 ASSEMBLE_DOUBLE_BINOP(mulsd);
368 break; 374 break;
369 case kSSEFloat64Div: 375 case kSSEFloat64Div:
370 __ divsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 376 ASSEMBLE_DOUBLE_BINOP(divsd);
371 break; 377 break;
372 case kSSEFloat64Mod: { 378 case kSSEFloat64Mod: {
373 __ subq(rsp, Immediate(kDoubleSize)); 379 __ subq(rsp, Immediate(kDoubleSize));
374 // Move values to st(0) and st(1). 380 // Move values to st(0) and st(1).
375 __ movsd(Operand(rsp, 0), i.InputDoubleRegister(1)); 381 __ movsd(Operand(rsp, 0), i.InputDoubleRegister(1));
376 __ fld_d(Operand(rsp, 0)); 382 __ fld_d(Operand(rsp, 0));
377 __ movsd(Operand(rsp, 0), i.InputDoubleRegister(0)); 383 __ movsd(Operand(rsp, 0), i.InputDoubleRegister(0));
378 __ fld_d(Operand(rsp, 0)); 384 __ fld_d(Operand(rsp, 0));
379 // Loop while fprem isn't done. 385 // Loop while fprem isn't done.
380 Label mod_loop; 386 Label mod_loop;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } 1009 }
1004 } 1010 }
1005 MarkLazyDeoptSite(); 1011 MarkLazyDeoptSite();
1006 } 1012 }
1007 1013
1008 #undef __ 1014 #undef __
1009 1015
1010 } // namespace internal 1016 } // namespace internal
1011 } // namespace compiler 1017 } // namespace compiler
1012 } // namespace v8 1018 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698