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

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

Issue 2252863003: [turbofan] Add Float32(Max|Min) machine operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Type is number now. Created 4 years, 3 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 break; 1041 break;
1042 case kSSEFloat64Mul: 1042 case kSSEFloat64Mul:
1043 __ mulsd(i.InputDoubleRegister(0), i.InputOperand(1)); 1043 __ mulsd(i.InputDoubleRegister(0), i.InputOperand(1));
1044 break; 1044 break;
1045 case kSSEFloat64Div: 1045 case kSSEFloat64Div:
1046 __ divsd(i.InputDoubleRegister(0), i.InputOperand(1)); 1046 __ divsd(i.InputDoubleRegister(0), i.InputOperand(1));
1047 // Don't delete this mov. It may improve performance on some CPUs, 1047 // Don't delete this mov. It may improve performance on some CPUs,
1048 // when there is a (v)mulsd depending on the result. 1048 // when there is a (v)mulsd depending on the result.
1049 __ movaps(i.OutputDoubleRegister(), i.OutputDoubleRegister()); 1049 __ movaps(i.OutputDoubleRegister(), i.OutputDoubleRegister());
1050 break; 1050 break;
1051 case kSSEFloat32Max: {
1052 Label compare_nan, compare_swap, done_compare;
1053 if (instr->InputAt(1)->IsFPRegister()) {
1054 __ ucomiss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1055 } else {
1056 __ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
1057 }
1058 auto ool =
1059 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1060 __ j(parity_even, ool->entry());
1061 __ j(above, &done_compare, Label::kNear);
1062 __ j(below, &compare_swap, Label::kNear);
1063 __ movmskps(i.TempRegister(0), i.InputDoubleRegister(0));
1064 __ test(i.TempRegister(0), Immediate(1));
1065 __ j(zero, &done_compare, Label::kNear);
1066 __ bind(&compare_swap);
1067 if (instr->InputAt(1)->IsFPRegister()) {
1068 __ movss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1069 } else {
1070 __ movss(i.InputDoubleRegister(0), i.InputOperand(1));
1071 }
1072 __ bind(&done_compare);
1073 __ bind(ool->exit());
1074 break;
1075 }
1076
1051 case kSSEFloat64Max: { 1077 case kSSEFloat64Max: {
1052 Label compare_nan, compare_swap, done_compare; 1078 Label compare_nan, compare_swap, done_compare;
1053 if (instr->InputAt(1)->IsFPRegister()) { 1079 if (instr->InputAt(1)->IsFPRegister()) {
1054 __ ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 1080 __ ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1055 } else { 1081 } else {
1056 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); 1082 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
1057 } 1083 }
1058 auto ool = 1084 auto ool =
1059 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); 1085 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister());
1060 __ j(parity_even, ool->entry()); 1086 __ j(parity_even, ool->entry());
1061 __ j(above, &done_compare, Label::kNear); 1087 __ j(above, &done_compare, Label::kNear);
1062 __ j(below, &compare_swap, Label::kNear); 1088 __ j(below, &compare_swap, Label::kNear);
1063 __ movmskpd(i.TempRegister(0), i.InputDoubleRegister(0)); 1089 __ movmskpd(i.TempRegister(0), i.InputDoubleRegister(0));
1064 __ test(i.TempRegister(0), Immediate(1)); 1090 __ test(i.TempRegister(0), Immediate(1));
1065 __ j(zero, &done_compare, Label::kNear); 1091 __ j(zero, &done_compare, Label::kNear);
1066 __ bind(&compare_swap); 1092 __ bind(&compare_swap);
1067 if (instr->InputAt(1)->IsFPRegister()) { 1093 if (instr->InputAt(1)->IsFPRegister()) {
1068 __ movsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 1094 __ movsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1069 } else { 1095 } else {
1070 __ movsd(i.InputDoubleRegister(0), i.InputOperand(1)); 1096 __ movsd(i.InputDoubleRegister(0), i.InputOperand(1));
1071 } 1097 }
1072 __ bind(&done_compare); 1098 __ bind(&done_compare);
1073 __ bind(ool->exit()); 1099 __ bind(ool->exit());
1074 break; 1100 break;
1075 } 1101 }
1102 case kSSEFloat32Min: {
1103 Label compare_swap, done_compare;
1104 if (instr->InputAt(1)->IsFPRegister()) {
1105 __ ucomiss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1106 } else {
1107 __ ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
1108 }
1109 auto ool =
1110 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1111 __ j(parity_even, ool->entry());
1112 __ j(below, &done_compare, Label::kNear);
1113 __ j(above, &compare_swap, Label::kNear);
1114 if (instr->InputAt(1)->IsFPRegister()) {
1115 __ movmskps(i.TempRegister(0), i.InputDoubleRegister(1));
1116 } else {
1117 __ movss(kScratchDoubleReg, i.InputOperand(1));
1118 __ movmskps(i.TempRegister(0), kScratchDoubleReg);
1119 }
1120 __ test(i.TempRegister(0), Immediate(1));
1121 __ j(zero, &done_compare, Label::kNear);
1122 __ bind(&compare_swap);
1123 if (instr->InputAt(1)->IsFPRegister()) {
1124 __ movss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1125 } else {
1126 __ movss(i.InputDoubleRegister(0), i.InputOperand(1));
1127 }
1128 __ bind(&done_compare);
1129 __ bind(ool->exit());
1130 break;
1131 }
1076 case kSSEFloat64Min: { 1132 case kSSEFloat64Min: {
1077 Label compare_swap, done_compare; 1133 Label compare_swap, done_compare;
1078 if (instr->InputAt(1)->IsFPRegister()) { 1134 if (instr->InputAt(1)->IsFPRegister()) {
1079 __ ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 1135 __ ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1080 } else { 1136 } else {
1081 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); 1137 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
1082 } 1138 }
1083 auto ool = 1139 auto ool =
1084 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); 1140 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister());
1085 __ j(parity_even, ool->entry()); 1141 __ j(parity_even, ool->entry());
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2268 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2213 __ Nop(padding_size); 2269 __ Nop(padding_size);
2214 } 2270 }
2215 } 2271 }
2216 2272
2217 #undef __ 2273 #undef __
2218 2274
2219 } // namespace compiler 2275 } // namespace compiler
2220 } // namespace internal 2276 } // namespace internal
2221 } // namespace v8 2277 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/ia32/instruction-codes-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698