Revision f230a1cf deps/v8/src/x64/assembler-x64.h
deps/v8/src/x64/assembler-x64.h | ||
---|---|---|
471 | 471 |
|
472 | 472 |
// Check whether a feature is supported by the target CPU. |
473 | 473 |
static bool IsSupported(CpuFeature f) { |
474 |
if (Check(f, cross_compile_)) return true; |
|
474 | 475 |
ASSERT(initialized_); |
475 | 476 |
if (f == SSE3 && !FLAG_enable_sse3) return false; |
476 | 477 |
if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; |
477 | 478 |
if (f == CMOV && !FLAG_enable_cmov) return false; |
478 | 479 |
if (f == SAHF && !FLAG_enable_sahf) return false; |
479 |
return (supported_ & (static_cast<uint64_t>(1) << f)) != 0;
|
|
480 |
return Check(f, supported_);
|
|
480 | 481 |
} |
481 | 482 |
|
482 | 483 |
static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
483 | 484 |
ASSERT(initialized_); |
484 |
return (found_by_runtime_probing_only_ & |
|
485 |
(static_cast<uint64_t>(1) << f)) != 0; |
|
485 |
return Check(f, found_by_runtime_probing_only_); |
|
486 | 486 |
} |
487 | 487 |
|
488 | 488 |
static bool IsSafeForSnapshot(CpuFeature f) { |
489 |
return (IsSupported(f) && |
|
489 |
return Check(f, cross_compile_) || |
|
490 |
(IsSupported(f) && |
|
490 | 491 |
(!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
491 | 492 |
} |
492 | 493 |
|
494 |
static bool VerifyCrossCompiling() { |
|
495 |
return cross_compile_ == 0; |
|
496 |
} |
|
497 |
|
|
498 |
static bool VerifyCrossCompiling(CpuFeature f) { |
|
499 |
uint64_t mask = flag2set(f); |
|
500 |
return cross_compile_ == 0 || |
|
501 |
(cross_compile_ & mask) == mask; |
|
502 |
} |
|
503 |
|
|
493 | 504 |
private: |
505 |
static bool Check(CpuFeature f, uint64_t set) { |
|
506 |
return (set & flag2set(f)) != 0; |
|
507 |
} |
|
508 |
|
|
509 |
static uint64_t flag2set(CpuFeature f) { |
|
510 |
return static_cast<uint64_t>(1) << f; |
|
511 |
} |
|
512 |
|
|
494 | 513 |
// Safe defaults include CMOV for X64. It is always available, if |
495 | 514 |
// anyone checks, but they shouldn't need to check. |
496 | 515 |
// The required user mode extensions in X64 are (from AMD64 ABI Table A.1): |
... | ... | |
503 | 522 |
static uint64_t supported_; |
504 | 523 |
static uint64_t found_by_runtime_probing_only_; |
505 | 524 |
|
525 |
static uint64_t cross_compile_; |
|
526 |
|
|
506 | 527 |
friend class ExternalReference; |
528 |
friend class PlatformFeatureScope; |
|
507 | 529 |
DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
508 | 530 |
}; |
509 | 531 |
|
... | ... | |
701 | 723 |
// All 64-bit immediates must have a relocation mode. |
702 | 724 |
void movq(Register dst, void* ptr, RelocInfo::Mode rmode); |
703 | 725 |
void movq(Register dst, int64_t value, RelocInfo::Mode rmode); |
704 |
void movq(Register dst, const char* s, RelocInfo::Mode rmode); |
|
705 | 726 |
// Moves the address of the external reference into the register. |
706 | 727 |
void movq(Register dst, ExternalReference ext); |
707 | 728 |
void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); |
... | ... | |
734 | 755 |
void cmovl(Condition cc, Register dst, const Operand& src); |
735 | 756 |
|
736 | 757 |
// Exchange two registers |
737 |
void xchg(Register dst, Register src); |
|
758 |
void xchgq(Register dst, Register src); |
|
759 |
void xchgl(Register dst, Register src); |
|
738 | 760 |
|
739 | 761 |
// Arithmetics |
740 | 762 |
void addl(Register dst, Register src) { |
... | ... | |
969 | 991 |
arithmetic_op(0x09, src, dst); |
970 | 992 |
} |
971 | 993 |
|
994 |
void orl(const Operand& dst, Register src) { |
|
995 |
arithmetic_op_32(0x09, src, dst); |
|
996 |
} |
|
997 |
|
|
972 | 998 |
void or_(Register dst, Immediate src) { |
973 | 999 |
immediate_arithmetic_op(0x1, dst, src); |
974 | 1000 |
} |
... | ... | |
994 | 1020 |
shift(dst, imm8, 0x0); |
995 | 1021 |
} |
996 | 1022 |
|
1023 |
void roll(Register dst, Immediate imm8) { |
|
1024 |
shift_32(dst, imm8, 0x0); |
|
1025 |
} |
|
1026 |
|
|
997 | 1027 |
void rcr(Register dst, Immediate imm8) { |
998 | 1028 |
shift(dst, imm8, 0x3); |
999 | 1029 |
} |
... | ... | |
1101 | 1131 |
arithmetic_op_32(0x2B, dst, src); |
1102 | 1132 |
} |
1103 | 1133 |
|
1134 |
void subl(const Operand& dst, Register src) { |
|
1135 |
arithmetic_op_32(0x29, src, dst); |
|
1136 |
} |
|
1137 |
|
|
1104 | 1138 |
void subl(const Operand& dst, Immediate src) { |
1105 | 1139 |
immediate_arithmetic_op_32(0x5, dst, src); |
1106 | 1140 |
} |
... | ... | |
1119 | 1153 |
void testb(const Operand& op, Register reg); |
1120 | 1154 |
void testl(Register dst, Register src); |
1121 | 1155 |
void testl(Register reg, Immediate mask); |
1156 |
void testl(const Operand& op, Register reg); |
|
1122 | 1157 |
void testl(const Operand& op, Immediate mask); |
1123 | 1158 |
void testq(const Operand& op, Register reg); |
1124 | 1159 |
void testq(Register dst, Register src); |
... | ... | |
1144 | 1179 |
immediate_arithmetic_op_32(0x6, dst, src); |
1145 | 1180 |
} |
1146 | 1181 |
|
1182 |
void xorl(const Operand& dst, Register src) { |
|
1183 |
arithmetic_op_32(0x31, src, dst); |
|
1184 |
} |
|
1185 |
|
|
1147 | 1186 |
void xorl(const Operand& dst, Immediate src) { |
1148 | 1187 |
immediate_arithmetic_op_32(0x6, dst, src); |
1149 | 1188 |
} |
... | ... | |
1307 | 1346 |
|
1308 | 1347 |
void sahf(); |
1309 | 1348 |
|
1349 |
// SSE instructions |
|
1350 |
void movaps(XMMRegister dst, XMMRegister src); |
|
1351 |
void movss(XMMRegister dst, const Operand& src); |
|
1352 |
void movss(const Operand& dst, XMMRegister src); |
|
1353 |
|
|
1354 |
void cvttss2si(Register dst, const Operand& src); |
|
1355 |
void cvttss2si(Register dst, XMMRegister src); |
|
1356 |
void cvtlsi2ss(XMMRegister dst, Register src); |
|
1357 |
|
|
1358 |
void xorps(XMMRegister dst, XMMRegister src); |
|
1359 |
void andps(XMMRegister dst, XMMRegister src); |
|
1360 |
|
|
1361 |
void movmskps(Register dst, XMMRegister src); |
|
1362 |
|
|
1310 | 1363 |
// SSE2 instructions |
1311 | 1364 |
void movd(XMMRegister dst, Register src); |
1312 | 1365 |
void movd(Register dst, XMMRegister src); |
1313 | 1366 |
void movq(XMMRegister dst, Register src); |
1314 | 1367 |
void movq(Register dst, XMMRegister src); |
1315 | 1368 |
void movq(XMMRegister dst, XMMRegister src); |
1316 |
void extractps(Register dst, XMMRegister src, byte imm8); |
|
1317 | 1369 |
|
1318 | 1370 |
// Don't use this unless it's important to keep the |
1319 | 1371 |
// top half of the destination register unchanged. |
... | ... | |
1331 | 1383 |
void movdqu(XMMRegister dst, const Operand& src); |
1332 | 1384 |
|
1333 | 1385 |
void movapd(XMMRegister dst, XMMRegister src); |
1334 |
void movaps(XMMRegister dst, XMMRegister src); |
|
1335 |
|
|
1336 |
void movss(XMMRegister dst, const Operand& src); |
|
1337 |
void movss(const Operand& dst, XMMRegister src); |
|
1338 | 1386 |
|
1339 |
void cvttss2si(Register dst, const Operand& src); |
|
1340 |
void cvttss2si(Register dst, XMMRegister src); |
|
1341 | 1387 |
void cvttsd2si(Register dst, const Operand& src); |
1342 | 1388 |
void cvttsd2si(Register dst, XMMRegister src); |
1343 | 1389 |
void cvttsd2siq(Register dst, XMMRegister src); |
... | ... | |
1347 | 1393 |
void cvtqsi2sd(XMMRegister dst, const Operand& src); |
1348 | 1394 |
void cvtqsi2sd(XMMRegister dst, Register src); |
1349 | 1395 |
|
1350 |
void cvtlsi2ss(XMMRegister dst, Register src); |
|
1351 | 1396 |
|
1352 | 1397 |
void cvtss2sd(XMMRegister dst, XMMRegister src); |
1353 | 1398 |
void cvtss2sd(XMMRegister dst, const Operand& src); |
... | ... | |
1366 | 1411 |
void andpd(XMMRegister dst, XMMRegister src); |
1367 | 1412 |
void orpd(XMMRegister dst, XMMRegister src); |
1368 | 1413 |
void xorpd(XMMRegister dst, XMMRegister src); |
1369 |
void xorps(XMMRegister dst, XMMRegister src); |
|
1370 | 1414 |
void sqrtsd(XMMRegister dst, XMMRegister src); |
1371 | 1415 |
|
1372 | 1416 |
void ucomisd(XMMRegister dst, XMMRegister src); |
1373 | 1417 |
void ucomisd(XMMRegister dst, const Operand& src); |
1418 |
void cmpltsd(XMMRegister dst, XMMRegister src); |
|
1419 |
|
|
1420 |
void movmskpd(Register dst, XMMRegister src); |
|
1421 |
|
|
1422 |
// SSE 4.1 instruction |
|
1423 |
void extractps(Register dst, XMMRegister src, byte imm8); |
|
1374 | 1424 |
|
1375 | 1425 |
enum RoundingMode { |
1376 | 1426 |
kRoundToNearest = 0x0, |
... | ... | |
1381 | 1431 |
|
1382 | 1432 |
void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode); |
1383 | 1433 |
|
1384 |
void movmskpd(Register dst, XMMRegister src); |
|
1385 |
void movmskps(Register dst, XMMRegister src); |
|
1386 |
|
|
1387 |
void cmpltsd(XMMRegister dst, XMMRegister src); |
|
1388 |
|
|
1389 |
// The first argument is the reg field, the second argument is the r/m field. |
|
1390 |
void emit_sse_operand(XMMRegister dst, XMMRegister src); |
|
1391 |
void emit_sse_operand(XMMRegister reg, const Operand& adr); |
|
1392 |
void emit_sse_operand(XMMRegister dst, Register src); |
|
1393 |
void emit_sse_operand(Register dst, XMMRegister src); |
|
1394 |
|
|
1395 | 1434 |
// Debugging |
1396 | 1435 |
void Print(); |
1397 | 1436 |
|
... | ... | |
1452 | 1491 |
void emit(byte x) { *pc_++ = x; } |
1453 | 1492 |
inline void emitl(uint32_t x); |
1454 | 1493 |
inline void emitp(void* x, RelocInfo::Mode rmode); |
1455 |
inline void emitq(uint64_t x, RelocInfo::Mode rmode);
|
|
1494 |
inline void emitq(uint64_t x); |
|
1456 | 1495 |
inline void emitw(uint16_t x); |
1457 | 1496 |
inline void emit_code_target(Handle<Code> target, |
1458 | 1497 |
RelocInfo::Mode rmode, |
... | ... | |
1572 | 1611 |
// Emit the code-object-relative offset of the label's position |
1573 | 1612 |
inline void emit_code_relative_offset(Label* label); |
1574 | 1613 |
|
1614 |
// The first argument is the reg field, the second argument is the r/m field. |
|
1615 |
void emit_sse_operand(XMMRegister dst, XMMRegister src); |
|
1616 |
void emit_sse_operand(XMMRegister reg, const Operand& adr); |
|
1617 |
void emit_sse_operand(XMMRegister dst, Register src); |
|
1618 |
void emit_sse_operand(Register dst, XMMRegister src); |
|
1619 |
|
|
1575 | 1620 |
// Emit machine code for one of the operations ADD, ADC, SUB, SBC, |
1576 | 1621 |
// AND, OR, XOR, or CMP. The encodings of these operations are all |
1577 | 1622 |
// similar, differing just in the opcode or in the reg field of the |
Also available in: Unified diff