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

Side by Side Diff: src/ia32/assembler-ia32.h

Issue 2744643004: [ia32] Add some SSE2, SSE4 instructions and AVX version for SIMD (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | src/ia32/assembler-ia32.cc » ('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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 void ucomisd(XMMRegister dst, XMMRegister src) { ucomisd(dst, Operand(src)); } 1020 void ucomisd(XMMRegister dst, XMMRegister src) { ucomisd(dst, Operand(src)); }
1021 void ucomisd(XMMRegister dst, const Operand& src); 1021 void ucomisd(XMMRegister dst, const Operand& src);
1022 1022
1023 void roundss(XMMRegister dst, XMMRegister src, RoundingMode mode); 1023 void roundss(XMMRegister dst, XMMRegister src, RoundingMode mode);
1024 void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode); 1024 void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode);
1025 1025
1026 void movmskpd(Register dst, XMMRegister src); 1026 void movmskpd(Register dst, XMMRegister src);
1027 void movmskps(Register dst, XMMRegister src); 1027 void movmskps(Register dst, XMMRegister src);
1028 1028
1029 void cmpltsd(XMMRegister dst, XMMRegister src); 1029 void cmpltsd(XMMRegister dst, XMMRegister src);
1030 void pcmpeqd(XMMRegister dst, XMMRegister src);
bbudge 2017/03/10 19:56:15 Why isn't this added to the SSE2 list instead? It
Jing 2017/03/13 03:23:28 It is in the SSE2_INSTRUCTION_LIST (see sse-instr.
1031 1030
1032 void punpckldq(XMMRegister dst, XMMRegister src); 1031 void punpckldq(XMMRegister dst, XMMRegister src);
1033 void punpckhdq(XMMRegister dst, XMMRegister src); 1032 void punpckhdq(XMMRegister dst, XMMRegister src);
bbudge 2017/03/10 19:56:15 Could you add these to the SSE/AVX list too?
Jing 2017/03/13 03:23:28 Done.
1034 1033
1035 void maxsd(XMMRegister dst, XMMRegister src) { maxsd(dst, Operand(src)); } 1034 void maxsd(XMMRegister dst, XMMRegister src) { maxsd(dst, Operand(src)); }
1036 void maxsd(XMMRegister dst, const Operand& src); 1035 void maxsd(XMMRegister dst, const Operand& src);
1037 void minsd(XMMRegister dst, XMMRegister src) { minsd(dst, Operand(src)); } 1036 void minsd(XMMRegister dst, XMMRegister src) { minsd(dst, Operand(src)); }
1038 void minsd(XMMRegister dst, const Operand& src); 1037 void minsd(XMMRegister dst, const Operand& src);
1039 1038
1040 void movdqa(XMMRegister dst, const Operand& src); 1039 void movdqa(XMMRegister dst, const Operand& src);
1041 void movdqa(const Operand& dst, XMMRegister src); 1040 void movdqa(const Operand& dst, XMMRegister src);
1042 void movdqu(XMMRegister dst, const Operand& src); 1041 void movdqu(XMMRegister dst, const Operand& src);
1043 void movdqu(const Operand& dst, XMMRegister src); 1042 void movdqu(const Operand& dst, XMMRegister src);
(...skipping 12 matching lines...) Expand all
1056 void movsd(XMMRegister dst, XMMRegister src) { movsd(dst, Operand(src)); } 1055 void movsd(XMMRegister dst, XMMRegister src) { movsd(dst, Operand(src)); }
1057 void movsd(XMMRegister dst, const Operand& src); 1056 void movsd(XMMRegister dst, const Operand& src);
1058 void movsd(const Operand& dst, XMMRegister src); 1057 void movsd(const Operand& dst, XMMRegister src);
1059 1058
1060 1059
1061 void movss(XMMRegister dst, const Operand& src); 1060 void movss(XMMRegister dst, const Operand& src);
1062 void movss(const Operand& dst, XMMRegister src); 1061 void movss(const Operand& dst, XMMRegister src);
1063 void movss(XMMRegister dst, XMMRegister src) { movss(dst, Operand(src)); } 1062 void movss(XMMRegister dst, XMMRegister src) { movss(dst, Operand(src)); }
1064 void extractps(Register dst, XMMRegister src, byte imm8); 1063 void extractps(Register dst, XMMRegister src, byte imm8);
1065 1064
1066 void pand(XMMRegister dst, XMMRegister src);
1067 void pxor(XMMRegister dst, XMMRegister src);
1068 void por(XMMRegister dst, XMMRegister src);
1069 void ptest(XMMRegister dst, XMMRegister src); 1065 void ptest(XMMRegister dst, XMMRegister src);
1070 1066
1071 void pslld(XMMRegister reg, int8_t shift); 1067 void pslld(XMMRegister reg, int8_t shift);
1072 void psrld(XMMRegister reg, int8_t shift); 1068 void psrld(XMMRegister reg, int8_t shift);
1073 void psllq(XMMRegister reg, int8_t shift); 1069 void psllq(XMMRegister reg, int8_t shift);
1074 void psllq(XMMRegister dst, XMMRegister src); 1070 void psllq(XMMRegister dst, XMMRegister src);
1075 void psrlq(XMMRegister reg, int8_t shift); 1071 void psrlq(XMMRegister reg, int8_t shift);
1076 void psrlq(XMMRegister dst, XMMRegister src); 1072 void psrlq(XMMRegister dst, XMMRegister src);
1077 void pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle); 1073 void pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle);
1078 void pextrd(Register dst, XMMRegister src, int8_t offset) { 1074 void pextrd(Register dst, XMMRegister src, int8_t offset) {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 v##instruction(dst, src1, Operand(src2)); \ 1434 v##instruction(dst, src1, Operand(src2)); \
1439 } \ 1435 } \
1440 void v##instruction(XMMRegister dst, XMMRegister src1, \ 1436 void v##instruction(XMMRegister dst, XMMRegister src1, \
1441 const Operand& src2) { \ 1437 const Operand& src2) { \
1442 vinstr(0x##opcode, dst, src1, src2, k##prefix, k##escape, kW0); \ 1438 vinstr(0x##opcode, dst, src1, src2, k##prefix, k##escape, kW0); \
1443 } 1439 }
1444 1440
1445 SSE2_INSTRUCTION_LIST(DECLARE_SSE2_AVX_INSTRUCTION) 1441 SSE2_INSTRUCTION_LIST(DECLARE_SSE2_AVX_INSTRUCTION)
1446 #undef DECLARE_SSE2_AVX_INSTRUCTION 1442 #undef DECLARE_SSE2_AVX_INSTRUCTION
1447 1443
1444 #define DECLARE_SSE4_INSTRUCTION(instruction, prefix, escape1, escape2, \
1445 opcode) \
1446 void instruction(XMMRegister dst, XMMRegister src) { \
1447 instruction(dst, Operand(src)); \
1448 } \
1449 void instruction(XMMRegister dst, const Operand& src) { \
1450 sse4_instr(dst, src, 0x##prefix, 0x##escape1, 0x##escape2, 0x##opcode); \
1451 }
1452
1453 SSE4_INSTRUCTION_LIST(DECLARE_SSE4_INSTRUCTION)
1454 #undef DECLARE_SSE4_INSTRUCTION
1455
1456 #define DECLARE_SSE4_AVX_INSTRUCTION(instruction, prefix, escape1, escape2, \
1457 opcode) \
1458 void v##instruction(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \
1459 v##instruction(dst, src1, Operand(src2)); \
1460 } \
1461 void v##instruction(XMMRegister dst, XMMRegister src1, \
1462 const Operand& src2) { \
1463 vinstr(0x##opcode, dst, src1, src2, k##prefix, k##escape1##escape2, kW0); \
1464 }
1465
1466 SSE4_INSTRUCTION_LIST(DECLARE_SSE4_AVX_INSTRUCTION)
1467 #undef DECLARE_SSE4_AVX_INSTRUCTION
1468
1448 // Prefetch src position into cache level. 1469 // Prefetch src position into cache level.
1449 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a 1470 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a
1450 // non-temporal 1471 // non-temporal
1451 void prefetch(const Operand& src, int level); 1472 void prefetch(const Operand& src, int level);
1452 // TODO(lrn): Need SFENCE for movnt? 1473 // TODO(lrn): Need SFENCE for movnt?
1453 1474
1454 // Check the code size generated from label to here. 1475 // Check the code size generated from label to here.
1455 int SizeOfCodeGeneratedSince(Label* label) { 1476 int SizeOfCodeGeneratedSince(Label* label) {
1456 return pc_offset() - label->pos(); 1477 return pc_offset() - label->pos();
1457 } 1478 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 void bind_to(Label* L, int pos); 1591 void bind_to(Label* L, int pos);
1571 1592
1572 // displacements 1593 // displacements
1573 inline Displacement disp_at(Label* L); 1594 inline Displacement disp_at(Label* L);
1574 inline void disp_at_put(Label* L, Displacement disp); 1595 inline void disp_at_put(Label* L, Displacement disp);
1575 inline void emit_disp(Label* L, Displacement::Type type); 1596 inline void emit_disp(Label* L, Displacement::Type type);
1576 inline void emit_near_disp(Label* L); 1597 inline void emit_near_disp(Label* L);
1577 1598
1578 void sse2_instr(XMMRegister dst, const Operand& src, byte prefix, byte escape, 1599 void sse2_instr(XMMRegister dst, const Operand& src, byte prefix, byte escape,
1579 byte opcode); 1600 byte opcode);
1601 void sse4_instr(XMMRegister dst, const Operand& src, byte prefix,
1602 byte escape1, byte escape2, byte opcode);
1580 void vinstr(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2, 1603 void vinstr(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2,
1581 SIMDPrefix pp, LeadingOpcode m, VexW w); 1604 SIMDPrefix pp, LeadingOpcode m, VexW w);
1582 // Most BMI instructions are similiar. 1605 // Most BMI instructions are similiar.
1583 void bmi1(byte op, Register reg, Register vreg, const Operand& rm); 1606 void bmi1(byte op, Register reg, Register vreg, const Operand& rm);
1584 void bmi2(SIMDPrefix pp, byte op, Register reg, Register vreg, 1607 void bmi2(SIMDPrefix pp, byte op, Register reg, Register vreg,
1585 const Operand& rm); 1608 const Operand& rm);
1586 1609
1587 // record reloc info for current pc_ 1610 // record reloc info for current pc_
1588 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); 1611 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1589 1612
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 Assembler* assembler_; 1647 Assembler* assembler_;
1625 #ifdef DEBUG 1648 #ifdef DEBUG
1626 int space_before_; 1649 int space_before_;
1627 #endif 1650 #endif
1628 }; 1651 };
1629 1652
1630 } // namespace internal 1653 } // namespace internal
1631 } // namespace v8 1654 } // namespace v8
1632 1655
1633 #endif // V8_IA32_ASSEMBLER_IA32_H_ 1656 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698