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

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: Function parameters are now pnacl abi compliant. Created 4 years, 11 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 //===- 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 InstX86BaseBinopXmm(const InstX86BaseBinopXmm &) = delete; 816 InstX86BaseBinopXmm(const InstX86BaseBinopXmm &) = delete;
817 InstX86BaseBinopXmm &operator=(const InstX86BaseBinopXmm &) = delete; 817 InstX86BaseBinopXmm &operator=(const InstX86BaseBinopXmm &) = delete;
818 818
819 public: 819 public:
820 using Base = InstX86BaseBinopXmm<K, NeedsElementType, Suffix>; 820 using Base = InstX86BaseBinopXmm<K, NeedsElementType, Suffix>;
821 821
822 void emit(const Cfg *Func) const override { 822 void emit(const Cfg *Func) const override {
823 if (!BuildDefs::dump()) 823 if (!BuildDefs::dump())
824 return; 824 return;
825 this->validateVectorAddrMode(); 825 this->validateVectorAddrMode();
826 const Type DestTy = ArithmeticTypeOverride == IceType_void
827 ? this->getDest()->getType()
828 : ArithmeticTypeOverride;
829 const char *SuffixString = "";
826 switch (Suffix) { 830 switch (Suffix) {
827 case InstX86Base::SseSuffix::None: 831 case InstX86Base::SseSuffix::None:
828 this->emitTwoAddress(Func, Opcode);
829 break; 832 break;
830 case InstX86Base::SseSuffix::Packed: { 833 case InstX86Base::SseSuffix::Packed:
831 const Type DestTy = this->getDest()->getType(); 834 SuffixString = Traits::TypeAttributes[DestTy].PdPsString;
832 this->emitTwoAddress(Func, this->Opcode, 835 break;
833 Traits::TypeAttributes[DestTy].PdPsString); 836 case InstX86Base::SseSuffix::Scalar:
834 } break; 837 SuffixString = Traits::TypeAttributes[DestTy].SdSsString;
835 case InstX86Base::SseSuffix::Scalar: { 838 break;
836 const Type DestTy = this->getDest()->getType(); 839 case InstX86Base::SseSuffix::Integral:
837 this->emitTwoAddress(Func, this->Opcode, 840 SuffixString = Traits::TypeAttributes[DestTy].PackString;
838 Traits::TypeAttributes[DestTy].SdSsString); 841 break;
839 } break;
840 case InstX86Base::SseSuffix::Integral: {
841 const Type DestTy = this->getDest()->getType();
842 this->emitTwoAddress(Func, this->Opcode,
843 Traits::TypeAttributes[DestTy].PackString);
844 } break;
845 } 842 }
843 this->emitTwoAddress(Func, Opcode, SuffixString);
846 } 844 }
847 void emitIAS(const Cfg *Func) const override { 845 void emitIAS(const Cfg *Func) const override {
848 this->validateVectorAddrMode(); 846 this->validateVectorAddrMode();
849 Type Ty = this->getDest()->getType(); 847 Type Ty = this->getDest()->getType();
850 if (NeedsElementType) 848 if (NeedsElementType)
851 Ty = typeElementType(Ty); 849 Ty = typeElementType(Ty);
852 assert(this->getSrcSize() == 2); 850 assert(this->getSrcSize() == 2);
853 emitIASRegOpTyXMM(Func, Ty, this->getDest(), this->getSrc(1), Emitter); 851 emitIASRegOpTyXMM(Func, Ty, this->getDest(), this->getSrc(1), Emitter);
854 } 852 }
855 void dump(const Cfg *Func) const override { 853 void dump(const Cfg *Func) const override {
856 if (!BuildDefs::dump()) 854 if (!BuildDefs::dump())
857 return; 855 return;
858 Ostream &Str = Func->getContext()->getStrDump(); 856 Ostream &Str = Func->getContext()->getStrDump();
859 this->dumpDest(Func); 857 this->dumpDest(Func);
860 Str << " = " << Opcode << "." << this->getDest()->getType() << " "; 858 Str << " = " << Opcode << "." << this->getDest()->getType() << " ";
861 this->dumpSources(Func); 859 this->dumpSources(Func);
862 } 860 }
863 static bool classof(const Inst *Inst) { 861 static bool classof(const Inst *Inst) {
864 return InstX86Base::isClassof(Inst, InstX86Base::K); 862 return InstX86Base::isClassof(Inst, InstX86Base::K);
865 } 863 }
866 864
867 protected: 865 protected:
868 InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source) 866 InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source,
869 : InstX86Base(Func, K, 2, Dest) { 867 Type ArithmeticTypeOverride = IceType_void)
868 : InstX86Base(Func, K, 2, Dest),
869 ArithmeticTypeOverride(ArithmeticTypeOverride) {
870 this->addSource(Dest); 870 this->addSource(Dest);
871 this->addSource(Source); 871 this->addSource(Source);
872 } 872 }
873 873
874 const Type ArithmeticTypeOverride;
874 static const char *Opcode; 875 static const char *Opcode;
875 static const XmmEmitterRegOp Emitter; 876 static const XmmEmitterRegOp Emitter;
876 }; 877 };
877 878
878 template <typename InstX86Base::InstKindX86 K, bool AllowAllTypes = false> 879 template <typename InstX86Base::InstKindX86 K, bool AllowAllTypes = false>
879 class InstX86BaseBinopXmmShift : public InstX86Base { 880 class InstX86BaseBinopXmmShift : public InstX86Base {
880 InstX86BaseBinopXmmShift() = delete; 881 InstX86BaseBinopXmmShift() = delete;
881 InstX86BaseBinopXmmShift(const InstX86BaseBinopXmmShift &) = delete; 882 InstX86BaseBinopXmmShift(const InstX86BaseBinopXmmShift &) = delete;
882 InstX86BaseBinopXmmShift & 883 InstX86BaseBinopXmmShift &
883 operator=(const InstX86BaseBinopXmmShift &) = delete; 884 operator=(const InstX86BaseBinopXmmShift &) = delete;
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 1908
1908 private: 1909 private:
1909 InstX86Psra(Cfg *Func, Variable *Dest, Operand *Source) 1910 InstX86Psra(Cfg *Func, Variable *Dest, Operand *Source)
1910 : InstX86BaseBinopXmmShift<InstX86Base::Psra>(Func, Dest, Source) {} 1911 : InstX86BaseBinopXmmShift<InstX86Base::Psra>(Func, Dest, Source) {}
1911 }; 1912 };
1912 1913
1913 class InstX86Pcmpeq 1914 class InstX86Pcmpeq
1914 : public InstX86BaseBinopXmm<InstX86Base::Pcmpeq, true, 1915 : public InstX86BaseBinopXmm<InstX86Base::Pcmpeq, true,
1915 InstX86Base::SseSuffix::Integral> { 1916 InstX86Base::SseSuffix::Integral> {
1916 public: 1917 public:
1917 static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source) { 1918 static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source,
1919 Type ArithmeticTypeOverride = IceType_void) {
1920 const Type Ty = ArithmeticTypeOverride == IceType_void
1921 ? Dest->getType()
1922 : ArithmeticTypeOverride;
1923 (void)Ty;
1924 assert((Ty != IceType_f64 && Ty != IceType_i64) ||
1925 InstX86Base::getTarget(Func)->getInstructionSet() >=
1926 Traits::SSE4_1);
1918 return new (Func->allocate<InstX86Pcmpeq>()) 1927 return new (Func->allocate<InstX86Pcmpeq>())
1919 InstX86Pcmpeq(Func, Dest, Source); 1928 InstX86Pcmpeq(Func, Dest, Source, ArithmeticTypeOverride);
1920 } 1929 }
1921 1930
1922 private: 1931 private:
1923 InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source) 1932 InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source,
1933 Type ArithmeticTypeOverride)
1924 : InstX86BaseBinopXmm<InstX86Base::Pcmpeq, true, 1934 : InstX86BaseBinopXmm<InstX86Base::Pcmpeq, true,
1925 InstX86Base::SseSuffix::Integral>(Func, Dest, 1935 InstX86Base::SseSuffix::Integral>(
1926 Source) {} 1936 Func, Dest, Source, ArithmeticTypeOverride) {}
1927 }; 1937 };
1928 1938
1929 class InstX86Pcmpgt 1939 class InstX86Pcmpgt
1930 : public InstX86BaseBinopXmm<InstX86Base::Pcmpgt, true, 1940 : public InstX86BaseBinopXmm<InstX86Base::Pcmpgt, true,
1931 InstX86Base::SseSuffix::Integral> { 1941 InstX86Base::SseSuffix::Integral> {
1932 public: 1942 public:
1933 static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) { 1943 static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) {
1944 assert(Dest->getType() != IceType_f64 ||
1945 InstX86Base::getTarget(Func)->getInstructionSet() >=
1946 Traits::SSE4_1);
1934 return new (Func->allocate<InstX86Pcmpgt>()) 1947 return new (Func->allocate<InstX86Pcmpgt>())
1935 InstX86Pcmpgt(Func, Dest, Source); 1948 InstX86Pcmpgt(Func, Dest, Source);
1936 } 1949 }
1937 1950
1938 private: 1951 private:
1939 InstX86Pcmpgt(Cfg *Func, Variable *Dest, Operand *Source) 1952 InstX86Pcmpgt(Cfg *Func, Variable *Dest, Operand *Source)
1940 : InstX86BaseBinopXmm<InstX86Base::Pcmpgt, true, 1953 : InstX86BaseBinopXmm<InstX86Base::Pcmpgt, true,
1941 InstX86Base::SseSuffix::Integral>(Func, Dest, 1954 InstX86Base::SseSuffix::Integral>(Func, Dest,
1942 Source) {} 1955 Source) {}
1943 }; 1956 };
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
3497 &InstImpl<TraitsType>::Assembler::psrl}; \ 3510 &InstImpl<TraitsType>::Assembler::psrl}; \
3498 } \ 3511 } \
3499 } 3512 }
3500 3513
3501 } // end of namespace X86NAMESPACE 3514 } // end of namespace X86NAMESPACE
3502 } // end of namespace Ice 3515 } // end of namespace Ice
3503 3516
3504 #include "IceInstX86BaseImpl.h" 3517 #include "IceInstX86BaseImpl.h"
3505 3518
3506 #endif // SUBZERO_SRC_ICEINSTX86BASE_H 3519 #endif // SUBZERO_SRC_ICEINSTX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698