OLD | NEW |
---|---|
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 Pcmpgt, | 227 Pcmpgt, |
228 Pextr, | 228 Pextr, |
229 Pinsr, | 229 Pinsr, |
230 Pmull, | 230 Pmull, |
231 Pmuludq, | 231 Pmuludq, |
232 Pop, | 232 Pop, |
233 Por, | 233 Por, |
234 Pshufd, | 234 Pshufd, |
235 Psll, | 235 Psll, |
236 Psra, | 236 Psra, |
237 Psrl, | |
237 Psub, | 238 Psub, |
238 Push, | 239 Push, |
239 Pxor, | 240 Pxor, |
240 Ret, | 241 Ret, |
241 Rol, | 242 Rol, |
242 Sar, | 243 Sar, |
243 Sbb, | 244 Sbb, |
244 Shl, | 245 Shl, |
245 Shld, | 246 Shld, |
246 Shr, | 247 Shr, |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 } | 780 } |
780 ~InstX8632BinopXmm() override {} | 781 ~InstX8632BinopXmm() override {} |
781 static const char *Opcode; | 782 static const char *Opcode; |
782 static const x86::AssemblerX86::XmmEmitterRegOp Emitter; | 783 static const x86::AssemblerX86::XmmEmitterRegOp Emitter; |
783 }; | 784 }; |
784 | 785 |
785 void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var, | 786 void emitIASXmmShift(const Cfg *Func, Type Ty, const Variable *Var, |
786 const Operand *Src, | 787 const Operand *Src, |
787 const x86::AssemblerX86::XmmEmitterShiftOp &Emitter); | 788 const x86::AssemblerX86::XmmEmitterShiftOp &Emitter); |
788 | 789 |
789 template <InstX8632::InstKindX8632 K> | 790 template <InstX8632::InstKindX8632 K, bool AllowAllTypes = false> |
790 class InstX8632BinopXmmShift : public InstX8632 { | 791 class InstX8632BinopXmmShift : public InstX8632 { |
791 InstX8632BinopXmmShift() = delete; | 792 InstX8632BinopXmmShift() = delete; |
792 InstX8632BinopXmmShift(const InstX8632BinopXmmShift &) = delete; | 793 InstX8632BinopXmmShift(const InstX8632BinopXmmShift &) = delete; |
793 InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete; | 794 InstX8632BinopXmmShift &operator=(const InstX8632BinopXmmShift &) = delete; |
794 | 795 |
795 public: | 796 public: |
796 // Create an XMM binary-op shift operation. | 797 // Create an XMM binary-op shift operation. |
797 static InstX8632BinopXmmShift *create(Cfg *Func, Variable *Dest, | 798 static InstX8632BinopXmmShift *create(Cfg *Func, Variable *Dest, |
798 Operand *Source) { | 799 Operand *Source) { |
799 return new (Func->allocate<InstX8632BinopXmmShift>()) | 800 return new (Func->allocate<InstX8632BinopXmmShift>()) |
800 InstX8632BinopXmmShift(Func, Dest, Source); | 801 InstX8632BinopXmmShift(Func, Dest, Source); |
801 } | 802 } |
802 void emit(const Cfg *Func) const override { | 803 void emit(const Cfg *Func) const override { |
803 if (!ALLOW_DUMP) | 804 if (!ALLOW_DUMP) |
804 return; | 805 return; |
805 const bool ShiftHack = false; | 806 const bool ShiftHack = false; |
806 emitTwoAddress(Opcode, this, Func, ShiftHack); | 807 emitTwoAddress(Opcode, this, Func, ShiftHack); |
807 } | 808 } |
808 void emitIAS(const Cfg *Func) const override { | 809 void emitIAS(const Cfg *Func) const override { |
809 Type Ty = getDest()->getType(); | 810 Type Ty = getDest()->getType(); |
810 assert(Ty == IceType_v8i16 || Ty == IceType_v8i1 || Ty == IceType_v4i32 || | 811 assert(AllowAllTypes || Ty == IceType_v8i16 || Ty == IceType_v8i1 || |
jvoung (off chromium)
2015/03/19 16:37:53
We might be able to get away with just removing th
Jim Stichnoth
2015/03/19 18:35:15
The problem here is that psra's Ty argument is act
jvoung (off chromium)
2015/03/19 18:50:33
Ah, ok that's what I missed.
| |
811 Ty == IceType_v4i1); | 812 Ty == IceType_v4i32 || Ty == IceType_v4i1); |
812 Type ElementTy = typeElementType(Ty); | 813 Type ElementTy = typeElementType(Ty); |
813 assert(getSrcSize() == 2); | 814 assert(getSrcSize() == 2); |
814 emitIASXmmShift(Func, ElementTy, getDest(), getSrc(1), Emitter); | 815 emitIASXmmShift(Func, ElementTy, getDest(), getSrc(1), Emitter); |
815 } | 816 } |
816 void dump(const Cfg *Func) const override { | 817 void dump(const Cfg *Func) const override { |
817 if (!ALLOW_DUMP) | 818 if (!ALLOW_DUMP) |
818 return; | 819 return; |
819 Ostream &Str = Func->getContext()->getStrDump(); | 820 Ostream &Str = Func->getContext()->getStrDump(); |
820 dumpDest(Func); | 821 dumpDest(Func); |
821 Str << " = " << Opcode << "." << getDest()->getType() << " "; | 822 Str << " = " << Opcode << "." << getDest()->getType() << " "; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1006 typedef InstX8632BinopGPR<InstX8632::Imul> InstX8632Imul; | 1007 typedef InstX8632BinopGPR<InstX8632::Imul> InstX8632Imul; |
1007 typedef InstX8632BinopXmm<InstX8632::Mulps, true> InstX8632Mulps; | 1008 typedef InstX8632BinopXmm<InstX8632::Mulps, true> InstX8632Mulps; |
1008 typedef InstX8632BinopXmm<InstX8632::Mulss, false> InstX8632Mulss; | 1009 typedef InstX8632BinopXmm<InstX8632::Mulss, false> InstX8632Mulss; |
1009 typedef InstX8632BinopXmm<InstX8632::Pmull, true> InstX8632Pmull; | 1010 typedef InstX8632BinopXmm<InstX8632::Pmull, true> InstX8632Pmull; |
1010 typedef InstX8632BinopXmm<InstX8632::Pmuludq, false> InstX8632Pmuludq; | 1011 typedef InstX8632BinopXmm<InstX8632::Pmuludq, false> InstX8632Pmuludq; |
1011 typedef InstX8632BinopXmm<InstX8632::Divps, true> InstX8632Divps; | 1012 typedef InstX8632BinopXmm<InstX8632::Divps, true> InstX8632Divps; |
1012 typedef InstX8632BinopXmm<InstX8632::Divss, false> InstX8632Divss; | 1013 typedef InstX8632BinopXmm<InstX8632::Divss, false> InstX8632Divss; |
1013 typedef InstX8632BinopGPRShift<InstX8632::Rol> InstX8632Rol; | 1014 typedef InstX8632BinopGPRShift<InstX8632::Rol> InstX8632Rol; |
1014 typedef InstX8632BinopGPRShift<InstX8632::Shl> InstX8632Shl; | 1015 typedef InstX8632BinopGPRShift<InstX8632::Shl> InstX8632Shl; |
1015 typedef InstX8632BinopXmmShift<InstX8632::Psll> InstX8632Psll; | 1016 typedef InstX8632BinopXmmShift<InstX8632::Psll> InstX8632Psll; |
1017 typedef InstX8632BinopXmmShift<InstX8632::Psrl, true> InstX8632Psrl; | |
1016 typedef InstX8632BinopGPRShift<InstX8632::Shr> InstX8632Shr; | 1018 typedef InstX8632BinopGPRShift<InstX8632::Shr> InstX8632Shr; |
1017 typedef InstX8632BinopGPRShift<InstX8632::Sar> InstX8632Sar; | 1019 typedef InstX8632BinopGPRShift<InstX8632::Sar> InstX8632Sar; |
1018 typedef InstX8632BinopXmmShift<InstX8632::Psra> InstX8632Psra; | 1020 typedef InstX8632BinopXmmShift<InstX8632::Psra> InstX8632Psra; |
1019 typedef InstX8632BinopXmm<InstX8632::Pcmpeq, true> InstX8632Pcmpeq; | 1021 typedef InstX8632BinopXmm<InstX8632::Pcmpeq, true> InstX8632Pcmpeq; |
1020 typedef InstX8632BinopXmm<InstX8632::Pcmpgt, true> InstX8632Pcmpgt; | 1022 typedef InstX8632BinopXmm<InstX8632::Pcmpgt, true> InstX8632Pcmpgt; |
1021 // movss is only a binary operation when the source and dest | 1023 // movss is only a binary operation when the source and dest |
1022 // operands are both registers (the high bits of dest are left untouched). | 1024 // operands are both registers (the high bits of dest are left untouched). |
1023 // In other cases, it behaves like a copy (mov-like) operation (and the | 1025 // In other cases, it behaves like a copy (mov-like) operation (and the |
1024 // high bits of dest are cleared). | 1026 // high bits of dest are cleared). |
1025 // InstX8632Movss will assert that both its source and dest operands are | 1027 // InstX8632Movss will assert that both its source and dest operands are |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1625 template <> void InstX8632Padd::emit(const Cfg *Func) const; | 1627 template <> void InstX8632Padd::emit(const Cfg *Func) const; |
1626 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const; | 1628 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const; |
1627 template <> void InstX8632Pcmpeq::emit(const Cfg *Func) const; | 1629 template <> void InstX8632Pcmpeq::emit(const Cfg *Func) const; |
1628 template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const; | 1630 template <> void InstX8632Pcmpgt::emit(const Cfg *Func) const; |
1629 template <> void InstX8632Pextr::emit(const Cfg *Func) const; | 1631 template <> void InstX8632Pextr::emit(const Cfg *Func) const; |
1630 template <> void InstX8632Pinsr::emit(const Cfg *Func) const; | 1632 template <> void InstX8632Pinsr::emit(const Cfg *Func) const; |
1631 template <> void InstX8632Pmull::emit(const Cfg *Func) const; | 1633 template <> void InstX8632Pmull::emit(const Cfg *Func) const; |
1632 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; | 1634 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; |
1633 template <> void InstX8632Psll::emit(const Cfg *Func) const; | 1635 template <> void InstX8632Psll::emit(const Cfg *Func) const; |
1634 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1636 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
1637 template <> void InstX8632Psrl::emit(const Cfg *Func) const; | |
1635 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1638 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
1636 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1639 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
1637 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1640 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
1638 | 1641 |
1639 template <> void InstX8632Blendvps::emitIAS(const Cfg *Func) const; | 1642 template <> void InstX8632Blendvps::emitIAS(const Cfg *Func) const; |
1640 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; | 1643 template <> void InstX8632Cbwdq::emitIAS(const Cfg *Func) const; |
1641 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; | 1644 template <> void InstX8632Div::emitIAS(const Cfg *Func) const; |
1642 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; | 1645 template <> void InstX8632Idiv::emitIAS(const Cfg *Func) const; |
1643 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; | 1646 template <> void InstX8632Imul::emitIAS(const Cfg *Func) const; |
1644 template <> void InstX8632Insertps::emitIAS(const Cfg *Func) const; | 1647 template <> void InstX8632Insertps::emitIAS(const Cfg *Func) const; |
1645 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; | 1648 template <> void InstX8632Movd::emitIAS(const Cfg *Func) const; |
1646 template <> void InstX8632MovssRegs::emitIAS(const Cfg *Func) const; | 1649 template <> void InstX8632MovssRegs::emitIAS(const Cfg *Func) const; |
1647 template <> void InstX8632Pblendvb::emitIAS(const Cfg *Func) const; | 1650 template <> void InstX8632Pblendvb::emitIAS(const Cfg *Func) const; |
1648 template <> void InstX8632Pextr::emitIAS(const Cfg *Func) const; | 1651 template <> void InstX8632Pextr::emitIAS(const Cfg *Func) const; |
1649 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1652 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
1650 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1653 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
1651 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1654 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
1652 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1655 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
1653 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1656 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
1654 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1657 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
1655 | 1658 |
1656 } // end of namespace Ice | 1659 } // end of namespace Ice |
1657 | 1660 |
1658 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1661 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |