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

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

Issue 2141063004: MIPS: Port '[turbofan] Introduce integer multiplication with overflow.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing files. Created 4 years, 5 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 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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 #include "src/compiler/code-generator.h" 6 #include "src/compiler/code-generator.h"
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/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 break; 844 break;
845 case kMips64Dsub: 845 case kMips64Dsub:
846 __ Dsubu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); 846 __ Dsubu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
847 break; 847 break;
848 case kMips64DsubOvf: 848 case kMips64DsubOvf:
849 // Pseudo-instruction used for overflow/branch. No opcode emitted here. 849 // Pseudo-instruction used for overflow/branch. No opcode emitted here.
850 break; 850 break;
851 case kMips64Mul: 851 case kMips64Mul:
852 __ Mul(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); 852 __ Mul(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
853 break; 853 break;
854 case kMips64MulOvf:
855 // Pseudo-instruction used for overflow/branch. No opcode emitted here.
856 break;
854 case kMips64MulHigh: 857 case kMips64MulHigh:
855 __ Mulh(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); 858 __ Mulh(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
856 break; 859 break;
857 case kMips64MulHighU: 860 case kMips64MulHighU:
858 __ Mulhu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); 861 __ Mulhu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
859 break; 862 break;
860 case kMips64DMulHigh: 863 case kMips64DMulHigh:
861 __ Dmulh(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); 864 __ Dmulh(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
862 break; 865 break;
863 case kMips64Div: 866 case kMips64Div:
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 i.InputOperand(1), tlabel, flabel); 1831 i.InputOperand(1), tlabel, flabel);
1829 break; 1832 break;
1830 case kNotOverflow: 1833 case kNotOverflow:
1831 __ DsubBranchOvf(i.OutputRegister(), i.InputRegister(0), 1834 __ DsubBranchOvf(i.OutputRegister(), i.InputRegister(0),
1832 i.InputOperand(1), flabel, tlabel); 1835 i.InputOperand(1), flabel, tlabel);
1833 break; 1836 break;
1834 default: 1837 default:
1835 UNSUPPORTED_COND(kMips64DsubOvf, branch->condition); 1838 UNSUPPORTED_COND(kMips64DsubOvf, branch->condition);
1836 break; 1839 break;
1837 } 1840 }
1841 } else if (instr->arch_opcode() == kMips64MulOvf) {
1842 switch (branch->condition) {
1843 case kOverflow: {
1844 __ MulBranchOvf(i.OutputRegister(), i.InputRegister(0),
1845 i.InputOperand(1), tlabel, flabel, kScratchReg);
1846 } break;
1847 case kNotOverflow: {
1848 __ MulBranchOvf(i.OutputRegister(), i.InputRegister(0),
1849 i.InputOperand(1), flabel, tlabel, kScratchReg);
1850 } break;
1851 default:
1852 UNSUPPORTED_COND(kMips64MulOvf, branch->condition);
1853 break;
1854 }
1838 } else if (instr->arch_opcode() == kMips64Cmp) { 1855 } else if (instr->arch_opcode() == kMips64Cmp) {
1839 cc = FlagsConditionToConditionCmp(branch->condition); 1856 cc = FlagsConditionToConditionCmp(branch->condition);
1840 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1)); 1857 __ Branch(tlabel, cc, i.InputRegister(0), i.InputOperand(1));
1841 } else if (instr->arch_opcode() == kMips64CmpS) { 1858 } else if (instr->arch_opcode() == kMips64CmpS) {
1842 if (!convertCondition(branch->condition, cc)) { 1859 if (!convertCondition(branch->condition, cc)) {
1843 UNSUPPORTED_COND(kMips64CmpS, branch->condition); 1860 UNSUPPORTED_COND(kMips64CmpS, branch->condition);
1844 } 1861 }
1845 FPURegister left = i.InputOrZeroSingleRegister(0); 1862 FPURegister left = i.InputOrZeroSingleRegister(0);
1846 FPURegister right = i.InputOrZeroSingleRegister(1); 1863 FPURegister right = i.InputOrZeroSingleRegister(1);
1847 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && 1864 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) &&
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 instr->arch_opcode() == kMips64Dsub) { 1920 instr->arch_opcode() == kMips64Dsub) {
1904 cc = FlagsConditionToConditionOvf(condition); 1921 cc = FlagsConditionToConditionOvf(condition);
1905 // Check for overflow creates 1 or 0 for result. 1922 // Check for overflow creates 1 or 0 for result.
1906 __ dsrl32(kScratchReg, i.OutputRegister(), 31); 1923 __ dsrl32(kScratchReg, i.OutputRegister(), 31);
1907 __ srl(at, i.OutputRegister(), 31); 1924 __ srl(at, i.OutputRegister(), 31);
1908 __ xor_(result, kScratchReg, at); 1925 __ xor_(result, kScratchReg, at);
1909 if (cc == eq) // Toggle result for not overflow. 1926 if (cc == eq) // Toggle result for not overflow.
1910 __ xori(result, result, 1); 1927 __ xori(result, result, 1);
1911 return; 1928 return;
1912 } else if (instr->arch_opcode() == kMips64DaddOvf || 1929 } else if (instr->arch_opcode() == kMips64DaddOvf ||
1913 instr->arch_opcode() == kMips64DsubOvf) { 1930 instr->arch_opcode() == kMips64DsubOvf ||
1931 instr->arch_opcode() == kMips64MulOvf) {
1914 Label flabel, tlabel; 1932 Label flabel, tlabel;
1915 switch (instr->arch_opcode()) { 1933 switch (instr->arch_opcode()) {
1916 case kMips64DaddOvf: 1934 case kMips64DaddOvf:
1917 __ DaddBranchNoOvf(i.OutputRegister(), i.InputRegister(0), 1935 __ DaddBranchNoOvf(i.OutputRegister(), i.InputRegister(0),
1918 i.InputOperand(1), &flabel); 1936 i.InputOperand(1), &flabel);
1919 1937
1920 break; 1938 break;
1921 case kMips64DsubOvf: 1939 case kMips64DsubOvf:
1922 __ DsubBranchNoOvf(i.OutputRegister(), i.InputRegister(0), 1940 __ DsubBranchNoOvf(i.OutputRegister(), i.InputRegister(0),
1923 i.InputOperand(1), &flabel); 1941 i.InputOperand(1), &flabel);
1924 break; 1942 break;
1943 case kMips64MulOvf:
1944 __ MulBranchNoOvf(i.OutputRegister(), i.InputRegister(0),
1945 i.InputOperand(1), &flabel, kScratchReg);
1946 break;
1925 default: 1947 default:
1926 UNREACHABLE(); 1948 UNREACHABLE();
1927 break; 1949 break;
1928 } 1950 }
1929 __ li(result, 1); 1951 __ li(result, 1);
1930 __ Branch(&tlabel); 1952 __ Branch(&tlabel);
1931 __ bind(&flabel); 1953 __ bind(&flabel);
1932 __ li(result, 0); 1954 __ li(result, 0);
1933 __ bind(&tlabel); 1955 __ bind(&tlabel);
1934 } else if (instr->arch_opcode() == kMips64Cmp) { 1956 } else if (instr->arch_opcode() == kMips64Cmp) {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 padding_size -= v8::internal::Assembler::kInstrSize; 2403 padding_size -= v8::internal::Assembler::kInstrSize;
2382 } 2404 }
2383 } 2405 }
2384 } 2406 }
2385 2407
2386 #undef __ 2408 #undef __
2387 2409
2388 } // namespace compiler 2410 } // namespace compiler
2389 } // namespace internal 2411 } // namespace internal
2390 } // namespace v8 2412 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | src/compiler/mips64/instruction-codes-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698