AVX-512: Added mask and rounding mode for scalar arithmetics
[oota-llvm.git] / lib / Target / Mips / MipsSEISelDAGToDAG.h
1 //===-- MipsSEISelDAGToDAG.h - A Dag to Dag Inst Selector for MipsSE -----===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Subclass of MipsDAGToDAGISel specialized for mips32/64.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
16
17 #include "MipsISelDAGToDAG.h"
18
19 namespace llvm {
20
21 class MipsSEDAGToDAGISel : public MipsDAGToDAGISel {
22
23 public:
24   explicit MipsSEDAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
25
26 private:
27
28   bool runOnMachineFunction(MachineFunction &MF) override;
29
30   void addDSPCtrlRegOperands(bool IsDef, MachineInstr &MI,
31                              MachineFunction &MF);
32
33   unsigned getMSACtrlReg(const SDValue RegIdx) const;
34
35   bool replaceUsesWithZeroReg(MachineRegisterInfo *MRI, const MachineInstr&);
36
37   std::pair<SDNode*, SDNode*> selectMULT(SDNode *N, unsigned Opc, SDLoc dl,
38                                          EVT Ty, bool HasLo, bool HasHi);
39
40   SDNode *selectAddESubE(unsigned MOp, SDValue InFlag, SDValue CmpLHS,
41                          SDLoc DL, SDNode *Node) const;
42
43   bool selectAddrFrameIndex(SDValue Addr, SDValue &Base, SDValue &Offset) const;
44   bool selectAddrFrameIndexOffset(SDValue Addr, SDValue &Base, SDValue &Offset,
45                                   unsigned OffsetBits) const;
46
47   bool selectAddrRegImm(SDValue Addr, SDValue &Base,
48                         SDValue &Offset) const override;
49
50   bool selectAddrRegReg(SDValue Addr, SDValue &Base,
51                         SDValue &Offset) const override;
52
53   bool selectAddrDefault(SDValue Addr, SDValue &Base,
54                          SDValue &Offset) const override;
55
56   bool selectIntAddr(SDValue Addr, SDValue &Base,
57                      SDValue &Offset) const override;
58
59   bool selectAddrRegImm10(SDValue Addr, SDValue &Base,
60                           SDValue &Offset) const;
61
62   bool selectAddrRegImm12(SDValue Addr, SDValue &Base,
63                           SDValue &Offset) const;
64
65   bool selectIntAddrMM(SDValue Addr, SDValue &Base,
66                        SDValue &Offset) const override;
67
68   bool selectIntAddrLSL2MM(SDValue Addr, SDValue &Base,
69                            SDValue &Offset) const override;
70
71   bool selectIntAddrMSA(SDValue Addr, SDValue &Base,
72                         SDValue &Offset) const override;
73
74   /// \brief Select constant vector splats.
75   bool selectVSplat(SDNode *N, APInt &Imm) const override;
76   /// \brief Select constant vector splats whose value fits in a given integer.
77   bool selectVSplatCommon(SDValue N, SDValue &Imm, bool Signed,
78                                   unsigned ImmBitSize) const;
79   /// \brief Select constant vector splats whose value fits in a uimm1.
80   bool selectVSplatUimm1(SDValue N, SDValue &Imm) const override;
81   /// \brief Select constant vector splats whose value fits in a uimm2.
82   bool selectVSplatUimm2(SDValue N, SDValue &Imm) const override;
83   /// \brief Select constant vector splats whose value fits in a uimm3.
84   bool selectVSplatUimm3(SDValue N, SDValue &Imm) const override;
85   /// \brief Select constant vector splats whose value fits in a uimm4.
86   bool selectVSplatUimm4(SDValue N, SDValue &Imm) const override;
87   /// \brief Select constant vector splats whose value fits in a uimm5.
88   bool selectVSplatUimm5(SDValue N, SDValue &Imm) const override;
89   /// \brief Select constant vector splats whose value fits in a uimm6.
90   bool selectVSplatUimm6(SDValue N, SDValue &Imm) const override;
91   /// \brief Select constant vector splats whose value fits in a uimm8.
92   bool selectVSplatUimm8(SDValue N, SDValue &Imm) const override;
93   /// \brief Select constant vector splats whose value fits in a simm5.
94   bool selectVSplatSimm5(SDValue N, SDValue &Imm) const override;
95   /// \brief Select constant vector splats whose value is a power of 2.
96   bool selectVSplatUimmPow2(SDValue N, SDValue &Imm) const override;
97   /// \brief Select constant vector splats whose value is the inverse of a
98   /// power of 2.
99   bool selectVSplatUimmInvPow2(SDValue N, SDValue &Imm) const override;
100   /// \brief Select constant vector splats whose value is a run of set bits
101   /// ending at the most significant bit
102   bool selectVSplatMaskL(SDValue N, SDValue &Imm) const override;
103   /// \brief Select constant vector splats whose value is a run of set bits
104   /// starting at bit zero.
105   bool selectVSplatMaskR(SDValue N, SDValue &Imm) const override;
106
107   std::pair<bool, SDNode*> selectNode(SDNode *Node) override;
108
109   void processFunctionAfterISel(MachineFunction &MF) override;
110
111   // Insert instructions to initialize the global base register in the
112   // first MBB of the function.
113   void initGlobalBaseReg(MachineFunction &MF);
114 };
115
116 FunctionPass *createMipsSEISelDag(MipsTargetMachine &TM);
117
118 }
119
120 #endif