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

Side by Side Diff: src/IceInstX86Base.h

Issue 1531623007: Add option to force filetype=asm for testing (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Formatting Created 5 years 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 //===- subzero/src/IceInstX86Base.h - Generic x86 instructions -*- C++ -*--===// 1 //===- subzero/src/IceInstX86Base.h - Generic 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 /// \file 10 /// \file
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 InstX86BaseBinopXmm(const InstX86BaseBinopXmm &) = delete; 757 InstX86BaseBinopXmm(const InstX86BaseBinopXmm &) = delete;
758 InstX86BaseBinopXmm &operator=(const InstX86BaseBinopXmm &) = delete; 758 InstX86BaseBinopXmm &operator=(const InstX86BaseBinopXmm &) = delete;
759 759
760 public: 760 public:
761 using Base = InstX86BaseBinopXmm<Machine, K, NeedsElementType, Suffix>; 761 using Base = InstX86BaseBinopXmm<Machine, K, NeedsElementType, Suffix>;
762 762
763 void emit(const Cfg *Func) const override { 763 void emit(const Cfg *Func) const override {
764 if (!BuildDefs::dump()) 764 if (!BuildDefs::dump())
765 return; 765 return;
766 this->validateVectorAddrMode(); 766 this->validateVectorAddrMode();
767 Type DestTy = this->getDest()->getType();
768 const char *SuffixString = "";
769 if (ArithmeticTypeOverride != IceType_void)
770 DestTy = ArithmeticTypeOverride;
771
767 switch (Suffix) { 772 switch (Suffix) {
768 case InstX86Base<Machine>::SseSuffix::None: 773 case InstX86Base<Machine>::SseSuffix::None:
769 this->emitTwoAddress(Func, Opcode);
770 break; 774 break;
771 case InstX86Base<Machine>::SseSuffix::Packed: { 775 case InstX86Base<Machine>::SseSuffix::Packed:
772 const Type DestTy = this->getDest()->getType(); 776 SuffixString =
773 this->emitTwoAddress( 777 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PdPsString;
774 Func, this->Opcode, 778 break;
775 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PdPsString); 779 case InstX86Base<Machine>::SseSuffix::Scalar:
776 } break; 780 SuffixString =
777 case InstX86Base<Machine>::SseSuffix::Scalar: { 781 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].SdSsString;
778 const Type DestTy = this->getDest()->getType(); 782 break;
779 this->emitTwoAddress( 783 case InstX86Base<Machine>::SseSuffix::Integral:
780 Func, this->Opcode, 784 SuffixString =
781 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].SdSsString); 785 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PackString;
782 } break; 786 break;
783 case InstX86Base<Machine>::SseSuffix::Integral: {
784 const Type DestTy = this->getDest()->getType();
785 this->emitTwoAddress(
786 Func, this->Opcode,
787 InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PackString);
788 } break;
789 } 787 }
788 this->emitTwoAddress(Func, Opcode, SuffixString);
790 } 789 }
791 void emitIAS(const Cfg *Func) const override { 790 void emitIAS(const Cfg *Func) const override {
792 this->validateVectorAddrMode(); 791 this->validateVectorAddrMode();
793 Type Ty = this->getDest()->getType(); 792 Type Ty = this->getDest()->getType();
794 if (NeedsElementType) 793 if (NeedsElementType)
795 Ty = typeElementType(Ty); 794 Ty = typeElementType(Ty);
796 assert(this->getSrcSize() == 2); 795 assert(this->getSrcSize() == 2);
797 emitIASRegOpTyXMM<Machine>(Func, Ty, this->getDest(), this->getSrc(1), 796 emitIASRegOpTyXMM<Machine>(Func, Ty, this->getDest(), this->getSrc(1),
798 Emitter); 797 Emitter);
799 } 798 }
800 void dump(const Cfg *Func) const override { 799 void dump(const Cfg *Func) const override {
801 if (!BuildDefs::dump()) 800 if (!BuildDefs::dump())
802 return; 801 return;
803 Ostream &Str = Func->getContext()->getStrDump(); 802 Ostream &Str = Func->getContext()->getStrDump();
804 this->dumpDest(Func); 803 this->dumpDest(Func);
805 Str << " = " << Opcode << "." << this->getDest()->getType() << " "; 804 Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
806 this->dumpSources(Func); 805 this->dumpSources(Func);
807 } 806 }
808 static bool classof(const Inst *Inst) { 807 static bool classof(const Inst *Inst) {
809 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::K); 808 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::K);
810 } 809 }
811 810
812 protected: 811 protected:
813 InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source) 812 InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source,
813 Type ArithmeticType = IceType_void)
814 : InstX86Base<Machine>(Func, K, 2, Dest) { 814 : InstX86Base<Machine>(Func, K, 2, Dest) {
815 this->addSource(Dest); 815 this->addSource(Dest);
816 this->addSource(Source); 816 this->addSource(Source);
817 ArithmeticTypeOverride = ArithmeticType;
Jim Stichnoth 2015/12/20 18:42:23 Can this assignment be moved into the ctor member
sehr 2016/01/07 18:53:11 Done.
817 } 818 }
818 819
820 Type ArithmeticTypeOverride;
819 static const char *Opcode; 821 static const char *Opcode;
820 static const typename InstX86Base<Machine>::Traits::Assembler::XmmEmitterRegOp 822 static const typename InstX86Base<Machine>::Traits::Assembler::XmmEmitterRegOp
821 Emitter; 823 Emitter;
822 }; 824 };
823 825
824 template <class Machine> 826 template <class Machine>
825 void emitIASXmmShift( 827 void emitIASXmmShift(
826 const Cfg *Func, Type Ty, const Variable *Var, const Operand *Src, 828 const Cfg *Func, Type Ty, const Variable *Var, const Operand *Src,
827 const typename InstX86Base<Machine>::Traits::Assembler::XmmEmitterShiftOp 829 const typename InstX86Base<Machine>::Traits::Assembler::XmmEmitterShiftOp
828 &Emitter); 830 &Emitter);
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 InstX86Psra(Cfg *Func, Variable *Dest, Operand *Source) 2005 InstX86Psra(Cfg *Func, Variable *Dest, Operand *Source)
2004 : InstX86BaseBinopXmmShift<Machine, InstX86Base<Machine>::Psra>( 2006 : InstX86BaseBinopXmmShift<Machine, InstX86Base<Machine>::Psra>(
2005 Func, Dest, Source) {} 2007 Func, Dest, Source) {}
2006 }; 2008 };
2007 2009
2008 template <class Machine> 2010 template <class Machine>
2009 class InstX86Pcmpeq 2011 class InstX86Pcmpeq
2010 : public InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true, 2012 : public InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true,
2011 InstX86Base<Machine>::SseSuffix::Integral> { 2013 InstX86Base<Machine>::SseSuffix::Integral> {
2012 public: 2014 public:
2013 static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source) { 2015 static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source,
2016 Type ArithmeticTypeOverride = IceType_void) {
2017 Type Ty = Dest->getType();
2018 if (ArithmeticTypeOverride != IceType_void)
2019 Ty = ArithmeticTypeOverride;
2020 (void)Ty;
2021 assert((Ty != IceType_f64 && Ty != IceType_i64) ||
2022 InstX86Base<Machine>::getTarget(Func)->getInstructionSet() >=
2023 InstX86Base<Machine>::Traits::SSE4_1);
2014 return new (Func->allocate<InstX86Pcmpeq>()) 2024 return new (Func->allocate<InstX86Pcmpeq>())
2015 InstX86Pcmpeq(Func, Dest, Source); 2025 InstX86Pcmpeq(Func, Dest, Source, ArithmeticTypeOverride);
2016 } 2026 }
2017 2027
2018 private: 2028 private:
2019 InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source) 2029 InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source,
2030 Type ArithmeticTypeOverride)
2020 : InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true, 2031 : InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true,
2021 InstX86Base<Machine>::SseSuffix::Integral>( 2032 InstX86Base<Machine>::SseSuffix::Integral>(
2022 Func, Dest, Source) {} 2033 Func, Dest, Source, ArithmeticTypeOverride) {}
2023 }; 2034 };
2024 2035
2025 template <class Machine> 2036 template <class Machine>
2026 class InstX86Pcmpgt 2037 class InstX86Pcmpgt
2027 : public InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpgt, true, 2038 : public InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpgt, true,
2028 InstX86Base<Machine>::SseSuffix::Integral> { 2039 InstX86Base<Machine>::SseSuffix::Integral> {
2029 public: 2040 public:
2030 static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) { 2041 static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) {
2042 assert(Dest->getType() != IceType_f64 ||
2043 InstX86Base<Machine>::getTarget(Func)->getInstructionSet() >=
2044 InstX86Base<Machine>::Traits::SSE4_1);
2031 return new (Func->allocate<InstX86Pcmpgt>()) 2045 return new (Func->allocate<InstX86Pcmpgt>())
2032 InstX86Pcmpgt(Func, Dest, Source); 2046 InstX86Pcmpgt(Func, Dest, Source);
2033 } 2047 }
2034 2048
2035 private: 2049 private:
2036 InstX86Pcmpgt(Cfg *Func, Variable *Dest, Operand *Source) 2050 InstX86Pcmpgt(Cfg *Func, Variable *Dest, Operand *Source)
2037 : InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpgt, true, 2051 : InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpgt, true,
2038 InstX86Base<Machine>::SseSuffix::Integral>( 2052 InstX86Base<Machine>::SseSuffix::Integral>(
2039 Func, Dest, Source) {} 2053 Func, Dest, Source) {}
2040 }; 2054 };
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 &InstX86Base<Machine>::Traits::Assembler::psrl}; \ 3447 &InstX86Base<Machine>::Traits::Assembler::psrl}; \
3434 } \ 3448 } \
3435 } 3449 }
3436 3450
3437 } // end of namespace X86Internal 3451 } // end of namespace X86Internal
3438 } // end of namespace Ice 3452 } // end of namespace Ice
3439 3453
3440 #include "IceInstX86BaseImpl.h" 3454 #include "IceInstX86BaseImpl.h"
3441 3455
3442 #endif // SUBZERO_SRC_ICEINSTX86BASE_H 3456 #endif // SUBZERO_SRC_ICEINSTX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698