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

Side by Side Diff: src/compiler/mips/instruction-selector-mips.cc

Issue 2919203002: [WASM] Eliminate SIMD boolean vector types. (Closed)
Patch Set: Restore DCHECKs in AssembleMove/Swap now that we're back to 1 SIMD representation. Created 3 years, 6 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 case MachineRepresentation::kTaggedSigned: // Fall through. 291 case MachineRepresentation::kTaggedSigned: // Fall through.
292 case MachineRepresentation::kTaggedPointer: // Fall through. 292 case MachineRepresentation::kTaggedPointer: // Fall through.
293 case MachineRepresentation::kTagged: // Fall through. 293 case MachineRepresentation::kTagged: // Fall through.
294 case MachineRepresentation::kWord32: 294 case MachineRepresentation::kWord32:
295 opcode = kMipsLw; 295 opcode = kMipsLw;
296 break; 296 break;
297 case MachineRepresentation::kSimd128: 297 case MachineRepresentation::kSimd128:
298 opcode = kMipsMsaLd; 298 opcode = kMipsMsaLd;
299 break; 299 break;
300 case MachineRepresentation::kWord64: // Fall through. 300 case MachineRepresentation::kWord64: // Fall through.
301 case MachineRepresentation::kSimd1x4: // Fall through.
302 case MachineRepresentation::kSimd1x8: // Fall through.
303 case MachineRepresentation::kSimd1x16: // Fall through.
304 case MachineRepresentation::kNone: 301 case MachineRepresentation::kNone:
305 UNREACHABLE(); 302 UNREACHABLE();
306 return; 303 return;
307 } 304 }
308 305
309 if (g.CanBeImmediate(index, opcode)) { 306 if (g.CanBeImmediate(index, opcode)) {
310 Emit(opcode | AddressingModeField::encode(kMode_MRI), 307 Emit(opcode | AddressingModeField::encode(kMode_MRI),
311 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); 308 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index));
312 } else { 309 } else {
313 InstructionOperand addr_reg = g.TempRegister(); 310 InstructionOperand addr_reg = g.TempRegister();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 case MachineRepresentation::kTaggedSigned: // Fall through. 378 case MachineRepresentation::kTaggedSigned: // Fall through.
382 case MachineRepresentation::kTaggedPointer: // Fall through. 379 case MachineRepresentation::kTaggedPointer: // Fall through.
383 case MachineRepresentation::kTagged: // Fall through. 380 case MachineRepresentation::kTagged: // Fall through.
384 case MachineRepresentation::kWord32: 381 case MachineRepresentation::kWord32:
385 opcode = kMipsSw; 382 opcode = kMipsSw;
386 break; 383 break;
387 case MachineRepresentation::kSimd128: 384 case MachineRepresentation::kSimd128:
388 opcode = kMipsMsaSt; 385 opcode = kMipsMsaSt;
389 break; 386 break;
390 case MachineRepresentation::kWord64: // Fall through. 387 case MachineRepresentation::kWord64: // Fall through.
391 case MachineRepresentation::kSimd1x4: // Fall through.
392 case MachineRepresentation::kSimd1x8: // Fall through.
393 case MachineRepresentation::kSimd1x16: // Fall through.
394 case MachineRepresentation::kNone: 388 case MachineRepresentation::kNone:
395 UNREACHABLE(); 389 UNREACHABLE();
396 return; 390 return;
397 } 391 }
398 392
399 if (g.CanBeImmediate(index, opcode)) { 393 if (g.CanBeImmediate(index, opcode)) {
400 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(), 394 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
401 g.UseRegister(base), g.UseImmediate(index), 395 g.UseRegister(base), g.UseImmediate(index),
402 g.UseRegisterOrImmediateZero(value)); 396 g.UseRegisterOrImmediateZero(value));
403 } else { 397 } else {
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 case MachineRepresentation::kFloat32: 1229 case MachineRepresentation::kFloat32:
1236 opcode = kMipsUlwc1; 1230 opcode = kMipsUlwc1;
1237 break; 1231 break;
1238 case MachineRepresentation::kFloat64: 1232 case MachineRepresentation::kFloat64:
1239 opcode = kMipsUldc1; 1233 opcode = kMipsUldc1;
1240 break; 1234 break;
1241 case MachineRepresentation::kSimd128: 1235 case MachineRepresentation::kSimd128:
1242 opcode = kMipsMsaLd; 1236 opcode = kMipsMsaLd;
1243 break; 1237 break;
1244 case MachineRepresentation::kWord64: // Fall through. 1238 case MachineRepresentation::kWord64: // Fall through.
1245 case MachineRepresentation::kSimd1x4: // Fall through.
1246 case MachineRepresentation::kSimd1x8: // Fall through.
1247 case MachineRepresentation::kSimd1x16: // Fall through.
1248 case MachineRepresentation::kNone: 1239 case MachineRepresentation::kNone:
1249 UNREACHABLE(); 1240 UNREACHABLE();
1250 return; 1241 return;
1251 } 1242 }
1252 1243
1253 if (g.CanBeImmediate(index, opcode)) { 1244 if (g.CanBeImmediate(index, opcode)) {
1254 Emit(opcode | AddressingModeField::encode(kMode_MRI), 1245 Emit(opcode | AddressingModeField::encode(kMode_MRI),
1255 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); 1246 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index));
1256 } else { 1247 } else {
1257 InstructionOperand addr_reg = g.TempRegister(); 1248 InstructionOperand addr_reg = g.TempRegister();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 case MachineRepresentation::kTaggedSigned: // Fall through. 1281 case MachineRepresentation::kTaggedSigned: // Fall through.
1291 case MachineRepresentation::kTaggedPointer: // Fall through. 1282 case MachineRepresentation::kTaggedPointer: // Fall through.
1292 case MachineRepresentation::kTagged: // Fall through. 1283 case MachineRepresentation::kTagged: // Fall through.
1293 case MachineRepresentation::kWord32: 1284 case MachineRepresentation::kWord32:
1294 opcode = kMipsUsw; 1285 opcode = kMipsUsw;
1295 break; 1286 break;
1296 case MachineRepresentation::kSimd128: 1287 case MachineRepresentation::kSimd128:
1297 opcode = kMipsMsaSt; 1288 opcode = kMipsMsaSt;
1298 break; 1289 break;
1299 case MachineRepresentation::kWord64: // Fall through. 1290 case MachineRepresentation::kWord64: // Fall through.
1300 case MachineRepresentation::kSimd1x4: // Fall through.
1301 case MachineRepresentation::kSimd1x8: // Fall through.
1302 case MachineRepresentation::kSimd1x16: // Fall through.
1303 case MachineRepresentation::kNone: 1291 case MachineRepresentation::kNone:
1304 UNREACHABLE(); 1292 UNREACHABLE();
1305 return; 1293 return;
1306 } 1294 }
1307 1295
1308 if (g.CanBeImmediate(index, opcode)) { 1296 if (g.CanBeImmediate(index, opcode)) {
1309 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(), 1297 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
1310 g.UseRegister(base), g.UseImmediate(index), 1298 g.UseRegister(base), g.UseImmediate(index),
1311 g.UseRegisterOrImmediateZero(value)); 1299 g.UseRegisterOrImmediateZero(value));
1312 } else { 1300 } else {
(...skipping 28 matching lines...) Expand all
1341 break; 1329 break;
1342 case MachineRepresentation::kFloat64: 1330 case MachineRepresentation::kFloat64:
1343 opcode = kCheckedLoadFloat64; 1331 opcode = kCheckedLoadFloat64;
1344 break; 1332 break;
1345 case MachineRepresentation::kBit: // Fall through. 1333 case MachineRepresentation::kBit: // Fall through.
1346 case MachineRepresentation::kTaggedSigned: // Fall through. 1334 case MachineRepresentation::kTaggedSigned: // Fall through.
1347 case MachineRepresentation::kTaggedPointer: // Fall through. 1335 case MachineRepresentation::kTaggedPointer: // Fall through.
1348 case MachineRepresentation::kTagged: // Fall through. 1336 case MachineRepresentation::kTagged: // Fall through.
1349 case MachineRepresentation::kWord64: // Fall through. 1337 case MachineRepresentation::kWord64: // Fall through.
1350 case MachineRepresentation::kSimd128: // Fall through. 1338 case MachineRepresentation::kSimd128: // Fall through.
1351 case MachineRepresentation::kSimd1x4: // Fall through.
1352 case MachineRepresentation::kSimd1x8: // Fall through.
1353 case MachineRepresentation::kSimd1x16: // Fall through.
1354 case MachineRepresentation::kNone: 1339 case MachineRepresentation::kNone:
1355 UNREACHABLE(); 1340 UNREACHABLE();
1356 return; 1341 return;
1357 } 1342 }
1358 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode) 1343 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode)
1359 ? g.UseImmediate(offset) 1344 ? g.UseImmediate(offset)
1360 : g.UseRegister(offset); 1345 : g.UseRegister(offset);
1361 1346
1362 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode)) 1347 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode))
1363 ? g.CanBeImmediate(length, opcode) 1348 ? g.CanBeImmediate(length, opcode)
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 V(F32x4) \ 1938 V(F32x4) \
1954 V(I32x4) \ 1939 V(I32x4) \
1955 V(I16x8) \ 1940 V(I16x8) \
1956 V(I8x16) 1941 V(I8x16)
1957 1942
1958 #define SIMD_FORMAT_LIST(V) \ 1943 #define SIMD_FORMAT_LIST(V) \
1959 V(32x4) \ 1944 V(32x4) \
1960 V(16x8) \ 1945 V(16x8) \
1961 V(8x16) 1946 V(8x16)
1962 1947
1963 #define SIMD_ZERO_OP_LIST(V) \
1964 V(S128Zero) \
1965 V(S1x4Zero) \
1966 V(S1x8Zero) \
1967 V(S1x16Zero)
1968
1969 #define SIMD_UNOP_LIST(V) \ 1948 #define SIMD_UNOP_LIST(V) \
1970 V(F32x4SConvertI32x4, kMipsF32x4SConvertI32x4) \ 1949 V(F32x4SConvertI32x4, kMipsF32x4SConvertI32x4) \
1971 V(F32x4UConvertI32x4, kMipsF32x4UConvertI32x4) \ 1950 V(F32x4UConvertI32x4, kMipsF32x4UConvertI32x4) \
1972 V(F32x4Abs, kMipsF32x4Abs) \ 1951 V(F32x4Abs, kMipsF32x4Abs) \
1973 V(F32x4Neg, kMipsF32x4Neg) \ 1952 V(F32x4Neg, kMipsF32x4Neg) \
1974 V(F32x4RecipApprox, kMipsF32x4RecipApprox) \ 1953 V(F32x4RecipApprox, kMipsF32x4RecipApprox) \
1975 V(F32x4RecipSqrtApprox, kMipsF32x4RecipSqrtApprox) \ 1954 V(F32x4RecipSqrtApprox, kMipsF32x4RecipSqrtApprox) \
1976 V(I32x4SConvertF32x4, kMipsI32x4SConvertF32x4) \ 1955 V(I32x4SConvertF32x4, kMipsI32x4SConvertF32x4) \
1977 V(I32x4UConvertF32x4, kMipsI32x4UConvertF32x4) \ 1956 V(I32x4UConvertF32x4, kMipsI32x4UConvertF32x4) \
1978 V(I32x4Neg, kMipsI32x4Neg) \ 1957 V(I32x4Neg, kMipsI32x4Neg) \
1979 V(I16x8Neg, kMipsI16x8Neg) \ 1958 V(I16x8Neg, kMipsI16x8Neg) \
1980 V(I8x16Neg, kMipsI8x16Neg) \ 1959 V(I8x16Neg, kMipsI8x16Neg) \
1981 V(S128Not, kMipsS128Not) \ 1960 V(S128Not, kMipsS128Not) \
1982 V(S1x4Not, kMipsS128Not) \
1983 V(S1x4AnyTrue, kMipsS1x4AnyTrue) \ 1961 V(S1x4AnyTrue, kMipsS1x4AnyTrue) \
1984 V(S1x4AllTrue, kMipsS1x4AllTrue) \ 1962 V(S1x4AllTrue, kMipsS1x4AllTrue) \
1985 V(S1x8Not, kMipsS128Not) \
1986 V(S1x8AnyTrue, kMipsS1x8AnyTrue) \ 1963 V(S1x8AnyTrue, kMipsS1x8AnyTrue) \
1987 V(S1x8AllTrue, kMipsS1x8AllTrue) \ 1964 V(S1x8AllTrue, kMipsS1x8AllTrue) \
1988 V(S1x16Not, kMipsS128Not) \
1989 V(S1x16AnyTrue, kMipsS1x16AnyTrue) \ 1965 V(S1x16AnyTrue, kMipsS1x16AnyTrue) \
1990 V(S1x16AllTrue, kMipsS1x16AllTrue) 1966 V(S1x16AllTrue, kMipsS1x16AllTrue)
1991 1967
1992 #define SIMD_SHIFT_OP_LIST(V) \ 1968 #define SIMD_SHIFT_OP_LIST(V) \
1993 V(I32x4Shl) \ 1969 V(I32x4Shl) \
1994 V(I32x4ShrS) \ 1970 V(I32x4ShrS) \
1995 V(I32x4ShrU) \ 1971 V(I32x4ShrU) \
1996 V(I16x8Shl) \ 1972 V(I16x8Shl) \
1997 V(I16x8ShrS) \ 1973 V(I16x8ShrS) \
1998 V(I16x8ShrU) \ 1974 V(I16x8ShrU) \
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 V(I8x16MaxU, kMipsI8x16MaxU) \ 2028 V(I8x16MaxU, kMipsI8x16MaxU) \
2053 V(I8x16MinU, kMipsI8x16MinU) \ 2029 V(I8x16MinU, kMipsI8x16MinU) \
2054 V(I8x16Eq, kMipsI8x16Eq) \ 2030 V(I8x16Eq, kMipsI8x16Eq) \
2055 V(I8x16Ne, kMipsI8x16Ne) \ 2031 V(I8x16Ne, kMipsI8x16Ne) \
2056 V(I8x16GtS, kMipsI8x16GtS) \ 2032 V(I8x16GtS, kMipsI8x16GtS) \
2057 V(I8x16GeS, kMipsI8x16GeS) \ 2033 V(I8x16GeS, kMipsI8x16GeS) \
2058 V(I8x16GtU, kMipsI8x16GtU) \ 2034 V(I8x16GtU, kMipsI8x16GtU) \
2059 V(I8x16GeU, kMipsI8x16GeU) \ 2035 V(I8x16GeU, kMipsI8x16GeU) \
2060 V(S128And, kMipsS128And) \ 2036 V(S128And, kMipsS128And) \
2061 V(S128Or, kMipsS128Or) \ 2037 V(S128Or, kMipsS128Or) \
2062 V(S128Xor, kMipsS128Xor) \ 2038 V(S128Xor, kMipsS128Xor)
2063 V(S1x4And, kMipsS128And) \
2064 V(S1x4Or, kMipsS128Or) \
2065 V(S1x4Xor, kMipsS128Xor) \
2066 V(S1x8And, kMipsS128And) \
2067 V(S1x8Or, kMipsS128Or) \
2068 V(S1x8Xor, kMipsS128Xor) \
2069 V(S1x16And, kMipsS128And) \
2070 V(S1x16Or, kMipsS128Or) \
2071 V(S1x16Xor, kMipsS128Xor)
2072 2039
2073 #define SIMD_VISIT_ZERO_OP(Name) \ 2040 void InstructionSelector::VisitS128Zero(Node* node) {
2074 void InstructionSelector::Visit##Name(Node* node) { \ 2041 MipsOperandGenerator g(this);
2075 MipsOperandGenerator g(this); \ 2042 Emit(kMipsS128Zero, g.DefineSameAsFirst(node));
2076 Emit(kMipsS128Zero, g.DefineSameAsFirst(node)); \ 2043 }
2077 }
2078 SIMD_ZERO_OP_LIST(SIMD_VISIT_ZERO_OP)
2079 #undef SIMD_VISIT_ZERO_OP
2080 2044
2081 #define SIMD_VISIT_SPLAT(Type) \ 2045 #define SIMD_VISIT_SPLAT(Type) \
2082 void InstructionSelector::Visit##Type##Splat(Node* node) { \ 2046 void InstructionSelector::Visit##Type##Splat(Node* node) { \
2083 VisitRR(this, kMips##Type##Splat, node); \ 2047 VisitRR(this, kMips##Type##Splat, node); \
2084 } 2048 }
2085 SIMD_TYPE_LIST(SIMD_VISIT_SPLAT) 2049 SIMD_TYPE_LIST(SIMD_VISIT_SPLAT)
2086 #undef SIMD_VISIT_SPLAT 2050 #undef SIMD_VISIT_SPLAT
2087 2051
2088 #define SIMD_VISIT_EXTRACT_LANE(Type) \ 2052 #define SIMD_VISIT_EXTRACT_LANE(Type) \
2089 void InstructionSelector::Visit##Type##ExtractLane(Node* node) { \ 2053 void InstructionSelector::Visit##Type##ExtractLane(Node* node) { \
(...skipping 23 matching lines...) Expand all
2113 SIMD_SHIFT_OP_LIST(SIMD_VISIT_SHIFT_OP) 2077 SIMD_SHIFT_OP_LIST(SIMD_VISIT_SHIFT_OP)
2114 #undef SIMD_VISIT_SHIFT_OP 2078 #undef SIMD_VISIT_SHIFT_OP
2115 2079
2116 #define SIMD_VISIT_BINOP(Name, instruction) \ 2080 #define SIMD_VISIT_BINOP(Name, instruction) \
2117 void InstructionSelector::Visit##Name(Node* node) { \ 2081 void InstructionSelector::Visit##Name(Node* node) { \
2118 VisitRRR(this, instruction, node); \ 2082 VisitRRR(this, instruction, node); \
2119 } 2083 }
2120 SIMD_BINOP_LIST(SIMD_VISIT_BINOP) 2084 SIMD_BINOP_LIST(SIMD_VISIT_BINOP)
2121 #undef SIMD_VISIT_BINOP 2085 #undef SIMD_VISIT_BINOP
2122 2086
2123 #define SIMD_VISIT_SELECT_OP(format) \ 2087 void InstructionSelector::VisitS128Select(Node* node) {
2124 void InstructionSelector::VisitS##format##Select(Node* node) { \ 2088 VisitRRRR(this, kMipsS128Select, node);
2125 VisitRRRR(this, kMipsS##format##Select, node); \ 2089 }
2126 }
2127 SIMD_FORMAT_LIST(SIMD_VISIT_SELECT_OP)
2128 #undef SIMD_VISIT_SELECT_OP
2129 2090
2130 // static 2091 // static
2131 MachineOperatorBuilder::Flags 2092 MachineOperatorBuilder::Flags
2132 InstructionSelector::SupportedMachineOperatorFlags() { 2093 InstructionSelector::SupportedMachineOperatorFlags() {
2133 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags; 2094 MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags;
2134 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) && 2095 if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) &&
2135 IsFp64Mode()) { 2096 IsFp64Mode()) {
2136 flags |= MachineOperatorBuilder::kFloat64RoundDown | 2097 flags |= MachineOperatorBuilder::kFloat64RoundDown |
2137 MachineOperatorBuilder::kFloat64RoundUp | 2098 MachineOperatorBuilder::kFloat64RoundUp |
2138 MachineOperatorBuilder::kFloat64RoundTruncate | 2099 MachineOperatorBuilder::kFloat64RoundTruncate |
(...skipping 23 matching lines...) Expand all
2162 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || 2123 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) ||
2163 IsMipsArchVariant(kMips32r2)); 2124 IsMipsArchVariant(kMips32r2));
2164 return MachineOperatorBuilder::AlignmentRequirements:: 2125 return MachineOperatorBuilder::AlignmentRequirements::
2165 NoUnalignedAccessSupport(); 2126 NoUnalignedAccessSupport();
2166 } 2127 }
2167 } 2128 }
2168 2129
2169 } // namespace compiler 2130 } // namespace compiler
2170 } // namespace internal 2131 } // namespace internal
2171 } // namespace v8 2132 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-codes-mips.h ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698