2007-12-29 20:36:04 +00:00
|
|
|
//===- SPUNodes.td - Specialized SelectionDAG nodes used for CellSPU ------===//
|
2007-12-05 01:24:05 +00:00
|
|
|
//
|
2007-12-05 01:40:25 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
2007-12-05 01:24:05 +00:00
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
2007-12-05 01:24:05 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Type profiles and SelectionDAG nodes used by CellSPU
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Type profile for a call sequence
|
|
|
|
def SDT_SPUCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
|
|
|
|
|
|
|
|
// SPU_GenControl: Type profile for generating control words for insertions
|
|
|
|
def SPU_GenControl : SDTypeProfile<1, 1, []>;
|
2008-11-22 23:50:42 +00:00
|
|
|
def SPUshufmask : SDNode<"SPUISD::SHUFFLE_MASK", SPU_GenControl, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_SPUCallSeq,
|
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
|
|
|
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_SPUCallSeq,
|
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Operand constraints:
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def SDT_SPUCall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
|
|
|
|
def SPUcall : SDNode<"SPUISD::CALL", SDT_SPUCall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
|
|
|
|
|
|
|
// Operand type constraints for vector shuffle/permute operations
|
|
|
|
def SDT_SPUshuffle : SDTypeProfile<1, 3, [
|
2008-02-23 18:41:37 +00:00
|
|
|
SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>
|
2007-12-05 01:24:05 +00:00
|
|
|
]>;
|
|
|
|
|
|
|
|
// Unary, binary v16i8 operator type constraints:
|
|
|
|
def SPUv16i8_binop: SDTypeProfile<1, 2, [
|
|
|
|
SDTCisVT<0, v16i8>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
|
|
|
|
|
|
|
|
// Binary v8i16 operator type constraints:
|
|
|
|
def SPUv8i16_binop: SDTypeProfile<1, 2, [
|
|
|
|
SDTCisVT<0, v8i16>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
|
|
|
|
|
|
|
|
// Binary v4i32 operator type constraints:
|
|
|
|
def SPUv4i32_binop: SDTypeProfile<1, 2, [
|
|
|
|
SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
|
|
|
|
|
2008-06-02 22:18:03 +00:00
|
|
|
// Trinary operators, e.g., addx, carry generate
|
|
|
|
def SPUIntTrinaryOp : SDTypeProfile<1, 3, [
|
|
|
|
SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisInt<0>
|
|
|
|
]>;
|
|
|
|
|
|
|
|
// SELECT_MASK type constraints: There are several variations for the various
|
2007-12-05 01:24:05 +00:00
|
|
|
// vector types (this avoids having to bit_convert all over the place.)
|
2008-06-02 22:18:03 +00:00
|
|
|
def SPUselmask_type: SDTypeProfile<1, 1, [
|
2008-04-30 00:30:08 +00:00
|
|
|
SDTCisInt<1>
|
|
|
|
]>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
// SELB type constraints:
|
2008-02-23 18:41:37 +00:00
|
|
|
def SPUselb_type: SDTypeProfile<1, 3, [
|
|
|
|
SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisSameAs<0, 3> ]>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
// SPU Vector shift pseudo-instruction type constraints
|
2008-02-23 18:41:37 +00:00
|
|
|
def SPUvecshift_type: SDTypeProfile<1, 2, [
|
|
|
|
SDTCisSameAs<0, 1>, SDTCisInt<2>]>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-12-27 04:51:36 +00:00
|
|
|
// SPU gather bits:
|
|
|
|
// This instruction looks at each vector (word|halfword|byte) slot's low bit
|
|
|
|
// and forms a mask in the low order bits of the first word's preferred slot.
|
|
|
|
def SPUgatherbits_type: SDTypeProfile<1, 1, [
|
|
|
|
/* no type constraints defined */
|
|
|
|
]>;
|
|
|
|
|
2007-12-05 01:24:05 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Synthetic/pseudo-instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-06-02 22:18:03 +00:00
|
|
|
/// Add extended, carry generate:
|
|
|
|
def SPUaddx : SDNode<"SPUISD::ADD_EXTENDED", SPUIntTrinaryOp, []>;
|
|
|
|
def SPUcarry_gen : SDNode<"SPUISD::CARRY_GENERATE", SDTIntBinOp, []>;
|
|
|
|
|
|
|
|
// Subtract extended, borrow generate
|
|
|
|
def SPUsubx : SDNode<"SPUISD::SUB_EXTENDED", SPUIntTrinaryOp, []>;
|
|
|
|
def SPUborrow_gen : SDNode<"SPUISD::BORROW_GENERATE", SDTIntBinOp, []>;
|
|
|
|
|
2007-12-05 01:24:05 +00:00
|
|
|
// SPU CNTB:
|
2008-06-02 22:18:03 +00:00
|
|
|
def SPUcntb : SDNode<"SPUISD::CNTB", SDTIntUnaryOp>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
// SPU vector shuffle node, matched by the SPUISD::SHUFB enum (see
|
|
|
|
// SPUISelLowering.h):
|
|
|
|
def SPUshuffle: SDNode<"SPUISD::SHUFB", SDT_SPUshuffle, []>;
|
|
|
|
|
|
|
|
// SPU 16-bit multiply
|
|
|
|
def SPUmpy_v16i8: SDNode<"SPUISD::MPY", SPUv16i8_binop, []>;
|
|
|
|
def SPUmpy_v8i16: SDNode<"SPUISD::MPY", SPUv8i16_binop, []>;
|
|
|
|
def SPUmpy_v4i32: SDNode<"SPUISD::MPY", SPUv4i32_binop, []>;
|
|
|
|
|
|
|
|
// SPU multiply unsigned, used in instruction lowering for v4i32
|
|
|
|
// multiplies:
|
|
|
|
def SPUmpyu_v4i32: SDNode<"SPUISD::MPYU", SPUv4i32_binop, []>;
|
|
|
|
def SPUmpyu_i32: SDNode<"SPUISD::MPYU", SDTIntBinOp, []>;
|
|
|
|
|
|
|
|
// SPU 16-bit multiply high x low, shift result 16-bits
|
|
|
|
// Used to compute intermediate products for 32-bit multiplies
|
|
|
|
def SPUmpyh_v4i32: SDNode<"SPUISD::MPYH", SPUv4i32_binop, []>;
|
|
|
|
def SPUmpyh_i32: SDNode<"SPUISD::MPYH", SDTIntBinOp, []>;
|
|
|
|
|
|
|
|
// SPU 16-bit multiply high x high, 32-bit product
|
|
|
|
// Used to compute intermediate products for 16-bit multiplies
|
|
|
|
def SPUmpyhh_v8i16: SDNode<"SPUISD::MPYHH", SPUv8i16_binop, []>;
|
|
|
|
|
2008-02-23 18:41:37 +00:00
|
|
|
// Shift left quadword by bits and bytes
|
|
|
|
def SPUshlquad_l_bits: SDNode<"SPUISD::SHLQUAD_L_BITS", SPUvecshift_type, []>;
|
|
|
|
def SPUshlquad_l_bytes: SDNode<"SPUISD::SHLQUAD_L_BYTES", SPUvecshift_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-02-23 18:41:37 +00:00
|
|
|
// Vector shifts (ISD::SHL,SRL,SRA are for _integers_ only):
|
|
|
|
def SPUvec_shl: SDNode<"SPUISD::VEC_SHL", SPUvecshift_type, []>;
|
|
|
|
def SPUvec_srl: SDNode<"SPUISD::VEC_SRL", SPUvecshift_type, []>;
|
|
|
|
def SPUvec_sra: SDNode<"SPUISD::VEC_SRA", SPUvecshift_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-02-23 18:41:37 +00:00
|
|
|
def SPUvec_rotl: SDNode<"SPUISD::VEC_ROTL", SPUvecshift_type, []>;
|
|
|
|
def SPUvec_rotr: SDNode<"SPUISD::VEC_ROTR", SPUvecshift_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-02-23 18:41:37 +00:00
|
|
|
def SPUrotquad_rz_bytes: SDNode<"SPUISD::ROTQUAD_RZ_BYTES",
|
|
|
|
SPUvecshift_type, []>;
|
|
|
|
def SPUrotquad_rz_bits: SDNode<"SPUISD::ROTQUAD_RZ_BITS",
|
|
|
|
SPUvecshift_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-06-02 22:18:03 +00:00
|
|
|
// Vector rotate left, bits shifted out of the left are rotated in on the right
|
2007-12-05 01:24:05 +00:00
|
|
|
def SPUrotbytes_left: SDNode<"SPUISD::ROTBYTES_LEFT",
|
2008-02-23 18:41:37 +00:00
|
|
|
SPUvecshift_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-06-02 22:18:03 +00:00
|
|
|
// Vector rotate left by bytes, but the count is given in bits and the SPU
|
|
|
|
// internally converts it to bytes (saves an instruction to mask off lower
|
|
|
|
// three bits)
|
|
|
|
def SPUrotbytes_left_bits : SDNode<"SPUISD::ROTBYTES_LEFT_BITS",
|
|
|
|
SPUvecshift_type>;
|
|
|
|
|
2007-12-05 01:24:05 +00:00
|
|
|
// SPU form select mask for bytes, immediate
|
2008-06-02 22:18:03 +00:00
|
|
|
def SPUselmask: SDNode<"SPUISD::SELECT_MASK", SPUselmask_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
// SPU select bits instruction
|
2008-02-23 18:41:37 +00:00
|
|
|
def SPUselb: SDNode<"SPUISD::SELB", SPUselb_type, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
2008-12-27 04:51:36 +00:00
|
|
|
// SPU gather bits instruction:
|
|
|
|
def SPUgatherbits: SDNode<"SPUISD::GATHER_BITS", SPUgatherbits_type, []>;
|
|
|
|
|
2007-12-05 01:24:05 +00:00
|
|
|
// SPU floating point interpolate
|
|
|
|
def SPUinterpolate : SDNode<"SPUISD::FPInterp", SDTFPBinOp, []>;
|
|
|
|
|
|
|
|
// SPU floating point reciprocal estimate (used for fdiv)
|
|
|
|
def SPUreciprocalEst: SDNode<"SPUISD::FPRecipEst", SDTFPUnaryOp, []>;
|
|
|
|
|
2008-12-27 04:51:36 +00:00
|
|
|
def SDTprefslot2vec: SDTypeProfile<1, 1, []>;
|
|
|
|
def SPUprefslot2vec: SDNode<"SPUISD::PREFSLOT2VEC", SDTprefslot2vec, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
def SPU_vec_demote : SDTypeProfile<1, 1, []>;
|
2008-11-24 17:11:17 +00:00
|
|
|
def SPUvec2prefslot: SDNode<"SPUISD::VEC2PREFSLOT", SPU_vec_demote, []>;
|
2007-12-05 01:24:05 +00:00
|
|
|
|
|
|
|
// Address high and low components, used for [r+r] type addressing
|
|
|
|
def SPUhi : SDNode<"SPUISD::Hi", SDTIntBinOp, []>;
|
|
|
|
def SPUlo : SDNode<"SPUISD::Lo", SDTIntBinOp, []>;
|
|
|
|
|
|
|
|
// PC-relative address
|
|
|
|
def SPUpcrel : SDNode<"SPUISD::PCRelAddr", SDTIntBinOp, []>;
|
|
|
|
|
2008-01-11 02:53:15 +00:00
|
|
|
// A-Form local store addresses
|
|
|
|
def SPUaform : SDNode<"SPUISD::AFormAddr", SDTIntBinOp, []>;
|
|
|
|
|
2008-01-29 02:16:57 +00:00
|
|
|
// Indirect [D-Form "imm($reg)" and X-Form "$reg($reg)"] addresses
|
|
|
|
def SPUindirect : SDNode<"SPUISD::IndirectAddr", SDTIntBinOp, []>;
|
2008-01-11 02:53:15 +00:00
|
|
|
|
2007-12-05 01:24:05 +00:00
|
|
|
// SPU 32-bit sign-extension to 64-bits
|
|
|
|
def SPUsext32_to_64: SDNode<"SPUISD::SEXT32TO64", SDTIntExtendOp, []>;
|
|
|
|
|
|
|
|
// Branches:
|
|
|
|
|
|
|
|
def SPUbrnz : SDNode<"SPUISD::BR_NOTZERO", SDTBrcond, [SDNPHasChain]>;
|
|
|
|
def SPUbrz : SDNode<"SPUISD::BR_ZERO", SDTBrcond, [SDNPHasChain]>;
|
|
|
|
/* def SPUbinz : SDNode<"SPUISD::BR_NOTZERO", SDTBrind, [SDNPHasChain]>;
|
|
|
|
def SPUbiz : SDNode<"SPUISD::BR_ZERO", SPUBrind, [SDNPHasChain]>; */
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Constraints: (taken from PPCInstrInfo.td)
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class RegConstraint<string C> {
|
|
|
|
string Constraints = C;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NoEncode<string E> {
|
|
|
|
string DisableEncoding = E;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Return (flag isn't quite what it means: the operations are flagged so that
|
|
|
|
// instruction scheduling doesn't disassociate them.)
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-01-15 22:02:54 +00:00
|
|
|
def retflag : SDNode<"SPUISD::RET_FLAG", SDTNone,
|
2007-12-05 01:24:05 +00:00
|
|
|
[SDNPHasChain, SDNPOptInFlag]>;
|