//==- AMDILFormats.td - AMDIL Instruction Formats ----*- tablegen -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //==-----------------------------------------------------------------------===// // //===--------------------------------------------------------------------===// include "AMDILTokenDesc.td" //===--------------------------------------------------------------------===// // The parent IL instruction class that inherits the Instruction class. This // class sets the corresponding namespace, the out and input dag lists the // pattern to match to and the string to print out for the assembly printer. //===--------------------------------------------------------------------===// class ILFormat pattern> : Instruction { let Namespace = "AMDIL"; dag OutOperandList = outs; dag InOperandList = ins; ILOpCode operation = op; let Pattern = pattern; let AsmString = !strconcat(asmstr, "\n"); let isPseudo = 1; bit hasIEEEFlag = 0; bit hasZeroOpFlag = 0; } //===--------------------------------------------------------------------===// // The base class for vector insert instructions. It is a single dest, quad // source instruction where the last two source operands must be 32bit // immediate values that are encoding the swizzle of the source register // The src2 and src3 instructions must also be inversion of each other such // that if src2 is 0x1000300(x0z0), src3 must be 0x20004(0y0w). The values // are encoded as 32bit integer with each 8 char representing a swizzle value. // The encoding is as follows for 32bit register types: // 0x00 -> '_' // 0x01 -> 'x' // 0x02 -> 'y' // 0x03 -> 'z' // 0x04 -> 'w' // 0x05 -> 'x' // 0x06 -> 'y' // 0x07 -> 'z' // 0x08 -> 'w' // 0x09 -> '0' // The encoding is as follows for 64bit register types: // 0x00 -> "__" // 0x01 -> "xy" // 0x02 -> "zw" // 0x03 -> "xy" // 0x04 -> "zw" // 0x05 -> "00" //===--------------------------------------------------------------------===// class InsertVectorClass : ILFormat; //===--------------------------------------------------------------------===// // Class that has one input parameters and one output parameter. // The basic pattern for this class is "Opcode Dst, Src0" and // handles the unary math operators. // It sets the binary token ILSrc, ILSrcMod, ILRelAddr and ILSrc and ILSrcMod // if the addressing is register relative for input and output register 0. //===--------------------------------------------------------------------===// class OneInOneOut pattern> : ILFormat { ILDst dst_reg; ILDstMod dst_mod; ILRelAddr dst_rel; ILSrc dst_reg_rel; ILSrcMod dst_reg_rel_mod; ILSrc src0_reg; ILSrcMod src0_mod; ILRelAddr src0_rel; ILSrc src0_reg_rel; ILSrcMod src0_reg_rel_mod; } //===--------------------------------------------------------------------===// // A simplified version of OneInOneOut class where the pattern is standard // and does not need special cases. This requires that the pattern has // a SDNode and takes a source and destination register that is of type // RegisterClass. This is the standard unary op class. //===--------------------------------------------------------------------===// class UnaryOp : OneInOneOut; //===--------------------------------------------------------------------===// // This class is similiar to the UnaryOp class, however, there is no // result value to assign. //===--------------------------------------------------------------------===// class UnaryOpNoRet pattern> : ILFormat { ILSrc src0_reg; ILSrcMod src0_mod; ILRelAddr src0_rel; ILSrc src0_reg_rel; ILSrcMod src0_reg_rel_mod; } //===--------------------------------------------------------------------===// // Set of classes that have two input parameters and one output parameter. // The basic pattern for this class is "Opcode Dst, Src0, Src1" and // handles the binary math operators and comparison operations. // It sets the binary token ILSrc, ILSrcMod, ILRelAddr and ILSrc and ILSrcMod // if the addressing is register relative for input register 1. //===--------------------------------------------------------------------===// class TwoInOneOut pattern> : OneInOneOut { ILSrc src1_reg; ILSrcMod src1_mod; ILRelAddr src1_rel; ILSrc src1_reg_rel; ILSrcMod src1_reg_rel_mod; } //===--------------------------------------------------------------------===// // A simplification of the TwoInOneOut pattern for Binary Operations. // This class is a helper class that assumes the simple pattern of // $dst = op $src0 $src1. // Other type of matching patterns need to use the TwoInOneOut class. //===--------------------------------------------------------------------===// class BinaryOp : TwoInOneOut; //===--------------------------------------------------------------------===// // The base class for vector extract instructions. The vector extract // instructions take as an input value a source register and a 32bit integer // with the same encoding as specified in InsertVectorClass and produces // a result with only the swizzled component in the destination register. //===--------------------------------------------------------------------===// class ExtractVectorClass : TwoInOneOut; //===--------------------------------------------------------------------===// // The base class for vector concatenation. This class creates either a vec2 // or a vec4 of 32bit data types or a vec2 of 64bit data types. This is done // by swizzling either the 'x' or 'xy' components of the source operands // into the destination register. //===--------------------------------------------------------------------===// class VectorConcatClass : TwoInOneOut; //===--------------------------------------------------------------------===// // Similiar to the UnaryOpNoRet class, but takes as arguments two input // operands. Used mainly for barrier instructions on PC platform. //===--------------------------------------------------------------------===// class BinaryOpNoRet pattern> : UnaryOpNoRet { ILSrc src1_reg; ILSrcMod src1_mod; ILRelAddr src1_rel; ILSrc src1_reg_rel; ILSrcMod src1_reg_rel_mod; } //===--------------------------------------------------------------------===// // Set of classes that have three input parameters and one output parameter. // The basic pattern for this class is "Opcode Dst, Src0, Src1, Src2" and // handles the mad and conditional mov instruction. // It sets the binary token ILSrc, ILSrcMod, ILRelAddr and ILSrc and ILSrcMod // if the addressing is register relative. // This class is the parent class of TernaryOp //===--------------------------------------------------------------------===// class ThreeInOneOut pattern> : TwoInOneOut { ILSrc src2_reg; ILSrcMod src2_mod; ILRelAddr src2_rel; ILSrc src2_reg_rel; ILSrcMod src2_reg_rel_mod; } //===--------------------------------------------------------------------===// // The g version of the Three Input pattern uses a standard pattern but // but allows specification of the register to further generalize the class // This class is mainly used in the generic multiclasses in AMDILMultiClass.td //===--------------------------------------------------------------------===// class TernaryOp : ThreeInOneOut; //===--------------------------------------------------------------------===// // Set of classes that have three input parameters and one output parameter. // The basic pattern for this class is "Opcode Dst, Src0, Src1, Src2" and // handles the mad and conditional mov instruction. // It sets the binary token ILSrc, ILSrcMod, ILRelAddr and ILSrc and ILSrcMod // if the addressing is register relative. // This class is the parent class of TernaryOp //===--------------------------------------------------------------------===// class FourInOneOut pattern> : ThreeInOneOut { ILSrc src3_reg; ILSrcMod src3_mod; ILRelAddr src3_rel; ILSrc src3_reg_rel; ILSrcMod src3_reg_rel_mod; } //===--------------------------------------------------------------------===// // The macro class that is an extension of OneInOneOut but is tailored for // macros only where all the register types are the same //===--------------------------------------------------------------------===// class UnaryMacro : OneInOneOut; //===--------------------------------------------------------------------===// // The macro class is an extension of TwoInOneOut but is tailored for // macros only where all the register types are the same //===--------------------------------------------------------------------===// class BinaryMacro : TwoInOneOut; //===--------------------------------------------------------------------===// // Classes for dealing with atomic instructions w/ 32bit pointers //===--------------------------------------------------------------------===// class Append : ILFormat; // TODO: Need to get this working without dst... class AppendNoRet : ILFormat; class UniAtom : ILFormat; // TODO: Need to get this working without dst... class UniAtomNoRet : ILFormat; class BinAtom : ILFormat; // TODO: Need to get this working without dst... class BinAtomNoRet : ILFormat; class TriAtom : ILFormat; class CmpXChg : ILFormat; // TODO: Need to get this working without dst... class TriAtomNoRet : ILFormat; // TODO: Need to get this working without dst... class CmpXChgNoRet : ILFormat; //===--------------------------------------------------------------------===// // Classes for dealing with atomic instructions w/ 64bit pointers //===--------------------------------------------------------------------===// class Append64 : ILFormat; // TODO: Need to get this working without dst... class AppendNoRet64 : ILFormat; class UniAtom64 : ILFormat; // TODO: Need to get this working without dst... class UniAtomNoRet64 : ILFormat; class BinAtom64 : ILFormat; // TODO: Need to get this working without dst... class BinAtomNoRet64 : ILFormat; class TriAtom64 : ILFormat; class CmpXChg64 : ILFormat; // TODO: Need to get this working without dst... class TriAtomNoRet64 : ILFormat; // TODO: Need to get this working without dst... class CmpXChgNoRet64 : ILFormat; //===--------------------------------------------------------------------===// // Intrinsic classes // Generic versions of the above classes but for Target specific intrinsics // instead of SDNode patterns. //===--------------------------------------------------------------------===// let TargetPrefix = "AMDIL", isTarget = 1 in { class VoidIntLong : Intrinsic<[llvm_i64_ty], [], []>; class VoidIntInt : Intrinsic<[llvm_i32_ty], [], []>; class VoidIntBool : Intrinsic<[llvm_i32_ty], [], []>; class UnaryIntInt : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], []>; class UnaryIntFloat : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], []>; class ConvertIntFTOI : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty], []>; class ConvertIntITOF : Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty], []>; class UnaryIntNoRetInt : Intrinsic<[], [llvm_anyint_ty], []>; class UnaryIntNoRetFloat : Intrinsic<[], [llvm_anyfloat_ty], []>; class BinaryIntInt : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>], []>; class BinaryIntFloat : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>], []>; class BinaryIntNoRetInt : Intrinsic<[], [llvm_anyint_ty, LLVMMatchType<0>], []>; class BinaryIntNoRetFloat : Intrinsic<[], [llvm_anyfloat_ty, LLVMMatchType<0>], []>; class TernaryIntInt : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], []>; class TernaryIntFloat : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], []>; class QuaternaryIntInt : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], []>; class UnaryAtomicInt : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>; class BinaryAtomicInt : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>; class TernaryAtomicInt : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>; class UnaryAtomicIntNoRet : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>; class BinaryAtomicIntNoRet : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>; class TernaryAtomicIntNoRet : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>; }