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

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

Issue 894883004: MIPS:[turbofan] Improve unordered comparisons for boolean materialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 5 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
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/mips64/assembler-mips64.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return ne; 255 return ne;
256 case kNotOverflow: 256 case kNotOverflow:
257 return eq; 257 return eq;
258 default: 258 default:
259 break; 259 break;
260 } 260 }
261 UNREACHABLE(); 261 UNREACHABLE();
262 return kNoCondition; 262 return kNoCondition;
263 } 263 }
264 264
265
266 FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
267 FlagsCondition condition) {
268 switch (condition) {
269 case kEqual:
270 predicate = true;
271 return EQ;
272 case kNotEqual:
273 predicate = false;
274 return EQ;
275 case kUnsignedLessThan:
276 predicate = true;
277 return OLT;
278 case kUnsignedLessThanOrEqual:
279 predicate = true;
280 return OLE;
281 case kUnorderedEqual:
282 case kUnorderedNotEqual:
283 predicate = true;
284 break;
285 default:
286 predicate = true;
287 break;
288 }
289 UNREACHABLE();
290 return kNoFPUCondition;
291 }
292
265 } // namespace 293 } // namespace
266 294
267 295
268 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ 296 #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \
269 do { \ 297 do { \
270 auto result = i.Output##width##Register(); \ 298 auto result = i.Output##width##Register(); \
271 auto ool = new (zone()) OutOfLineLoad##width(this, result); \ 299 auto ool = new (zone()) OutOfLineLoad##width(this, result); \
272 if (instr->InputAt(0)->IsRegister()) { \ 300 if (instr->InputAt(0)->IsRegister()) { \
273 auto offset = i.InputRegister(0); \ 301 auto offset = i.InputRegister(0); \
274 __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ 302 __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 break; 989 break;
962 default: 990 default:
963 UNSUPPORTED_COND(kMips64Cmp32, condition); 991 UNSUPPORTED_COND(kMips64Cmp32, condition);
964 break; 992 break;
965 } 993 }
966 __ Branch(USE_DELAY_SLOT, &done, cc, left, right); 994 __ Branch(USE_DELAY_SLOT, &done, cc, left, right);
967 __ li(result, Operand(1)); // In delay slot. 995 __ li(result, Operand(1)); // In delay slot.
968 } else if (instr->arch_opcode() == kMips64CmpD) { 996 } else if (instr->arch_opcode() == kMips64CmpD) {
969 FPURegister left = i.InputDoubleRegister(0); 997 FPURegister left = i.InputDoubleRegister(0);
970 FPURegister right = i.InputDoubleRegister(1); 998 FPURegister right = i.InputDoubleRegister(1);
971 // TODO(plind): Provide NaN-testing macro-asm function without need for 999
972 // BranchF. 1000 bool predicate;
973 FPURegister dummy1 = f0; 1001 FPUCondition cc = FlagsConditionToConditionCmpD(predicate, condition);
974 FPURegister dummy2 = f2; 1002 if (kArchVariant != kMips64r6) {
975 switch (condition) { 1003 __ li(result, Operand(1));
976 case kEqual: 1004 __ c(cc, D, left, right);
977 // TODO(plind): improve the NaN testing throughout this function. 1005 if (predicate) {
978 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); 1006 __ Movf(result, zero_reg);
979 cc = eq; 1007 } else {
980 break; 1008 __ Movt(result, zero_reg);
981 case kNotEqual: 1009 }
982 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2); 1010 } else {
983 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN. 1011 __ cmp(cc, L, kDoubleCompareReg, left, right);
984 cc = ne; 1012 __ dmfc1(at, kDoubleCompareReg);
985 break; 1013 __ dsrl32(result, at, 31); // Cmp returns all 1s for true.
986 case kUnsignedLessThan: 1014 if (!predicate) // Toggle result for not equal.
987 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2); 1015 __ xori(result, result, 1);
988 cc = lt;
989 break;
990 case kUnsignedGreaterThanOrEqual:
991 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2);
992 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN.
993 cc = ge;
994 break;
995 case kUnsignedLessThanOrEqual:
996 __ BranchF(NULL, &false_value, kNoCondition, dummy1, dummy2);
997 cc = le;
998 break;
999 case kUnsignedGreaterThan:
1000 __ BranchF(USE_DELAY_SLOT, NULL, &done, kNoCondition, dummy1, dummy2);
1001 __ li(result, Operand(1)); // In delay slot - returns 1 on NaN.
1002 cc = gt;
1003 break;
1004 default:
1005 UNSUPPORTED_COND(kMips64Cmp, condition);
1006 break;
1007 } 1016 }
1008 __ BranchF(USE_DELAY_SLOT, &done, NULL, cc, left, right); 1017 return;
1009 __ li(result, Operand(1)); // In delay slot - branch taken returns 1.
1010 // Fall-thru (branch not taken) returns 0.
1011
1012 } else { 1018 } else {
1013 PrintF("AssembleArchBranch Unimplemented arch_opcode is : %d\n", 1019 PrintF("AssembleArchBranch Unimplemented arch_opcode is : %d\n",
1014 instr->arch_opcode()); 1020 instr->arch_opcode());
1015 TRACE_UNIMPL(); 1021 TRACE_UNIMPL();
1016 UNIMPLEMENTED(); 1022 UNIMPLEMENTED();
1017 } 1023 }
1018 // Fallthru case is the false materialization. 1024 // Fallthru case is the false materialization.
1019 __ bind(&false_value); 1025 __ bind(&false_value);
1020 __ li(result, Operand(static_cast<int64_t>(0))); 1026 __ li(result, Operand(static_cast<int64_t>(0)));
1021 __ bind(&done); 1027 __ bind(&done);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 } 1319 }
1314 } 1320 }
1315 MarkLazyDeoptSite(); 1321 MarkLazyDeoptSite();
1316 } 1322 }
1317 1323
1318 #undef __ 1324 #undef __
1319 1325
1320 } // namespace compiler 1326 } // namespace compiler
1321 } // namespace internal 1327 } // namespace internal
1322 } // namespace v8 1328 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698