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

Side by Side Diff: src/compiler/x64/code-generator-x64.cc

Issue 1584663007: [turbofan] Implement rounding of floats on x64 and ia32 without sse4.1. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: reduced generated code. Created 4 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
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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 case kSSEFloat32Max: 934 case kSSEFloat32Max:
935 ASSEMBLE_SSE_BINOP(maxss); 935 ASSEMBLE_SSE_BINOP(maxss);
936 break; 936 break;
937 case kSSEFloat32Min: 937 case kSSEFloat32Min:
938 ASSEMBLE_SSE_BINOP(minss); 938 ASSEMBLE_SSE_BINOP(minss);
939 break; 939 break;
940 case kSSEFloat32ToFloat64: 940 case kSSEFloat32ToFloat64:
941 ASSEMBLE_SSE_UNOP(Cvtss2sd); 941 ASSEMBLE_SSE_UNOP(Cvtss2sd);
942 break; 942 break;
943 case kSSEFloat32Round: { 943 case kSSEFloat32Round: {
944 CpuFeatureScope sse_scope(masm(), SSE4_1);
945 RoundingMode const mode = 944 RoundingMode const mode =
946 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); 945 static_cast<RoundingMode>(MiscField::decode(instr->opcode()));
947 __ Roundss(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); 946 __ Roundss(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
947 kScratchRegister, kScratchDoubleReg, mode);
948 break; 948 break;
949 } 949 }
950 case kSSEFloat32ToInt32: 950 case kSSEFloat32ToInt32:
951 if (instr->InputAt(0)->IsDoubleRegister()) { 951 if (instr->InputAt(0)->IsDoubleRegister()) {
952 __ Cvttss2si(i.OutputRegister(), i.InputDoubleRegister(0)); 952 __ Cvttss2si(i.OutputRegister(), i.InputDoubleRegister(0));
953 } else { 953 } else {
954 __ Cvttss2si(i.OutputRegister(), i.InputOperand(0)); 954 __ Cvttss2si(i.OutputRegister(), i.InputOperand(0));
955 } 955 }
956 break; 956 break;
957 case kSSEFloat64Cmp: 957 case kSSEFloat64Cmp:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // TODO(bmeurer): Use RIP relative 128-bit constants. 1021 // TODO(bmeurer): Use RIP relative 128-bit constants.
1022 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 1022 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
1023 __ psllq(kScratchDoubleReg, 63); 1023 __ psllq(kScratchDoubleReg, 63);
1024 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); 1024 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg);
1025 break; 1025 break;
1026 } 1026 }
1027 case kSSEFloat64Sqrt: 1027 case kSSEFloat64Sqrt:
1028 ASSEMBLE_SSE_UNOP(sqrtsd); 1028 ASSEMBLE_SSE_UNOP(sqrtsd);
1029 break; 1029 break;
1030 case kSSEFloat64Round: { 1030 case kSSEFloat64Round: {
1031 CpuFeatureScope sse_scope(masm(), SSE4_1);
1032 RoundingMode const mode = 1031 RoundingMode const mode =
1033 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); 1032 static_cast<RoundingMode>(MiscField::decode(instr->opcode()));
1034 __ Roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); 1033 __ Roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
1034 kScratchRegister, kScratchDoubleReg, mode);
1035 break; 1035 break;
1036 } 1036 }
1037 case kSSEFloat64ToFloat32: 1037 case kSSEFloat64ToFloat32:
1038 ASSEMBLE_SSE_UNOP(Cvtsd2ss); 1038 ASSEMBLE_SSE_UNOP(Cvtsd2ss);
1039 break; 1039 break;
1040 case kSSEFloat64ToInt32: 1040 case kSSEFloat64ToInt32:
1041 if (instr->InputAt(0)->IsDoubleRegister()) { 1041 if (instr->InputAt(0)->IsDoubleRegister()) {
1042 __ Cvttsd2si(i.OutputRegister(), i.InputDoubleRegister(0)); 1042 __ Cvttsd2si(i.OutputRegister(), i.InputDoubleRegister(0));
1043 } else { 1043 } else {
1044 __ Cvttsd2si(i.OutputRegister(), i.InputOperand(0)); 1044 __ Cvttsd2si(i.OutputRegister(), i.InputOperand(0));
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2135 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2136 __ Nop(padding_size); 2136 __ Nop(padding_size);
2137 } 2137 }
2138 } 2138 }
2139 2139
2140 #undef __ 2140 #undef __
2141 2141
2142 } // namespace compiler 2142 } // namespace compiler
2143 } // namespace internal 2143 } // namespace internal
2144 } // namespace v8 2144 } // 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