1/*
2 * Copyright 2020 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#ifndef __NV50_IR_LOWERING_GV100_H__
23#define __NV50_IR_LOWERING_GV100_H__
24#include "nv50_ir_lowering_gm107.h"
25
26namespace nv50_ir {
27
28class GV100LoweringPass : public Pass
29{
30public:
31   GV100LoweringPass(Program *p) {
32      bld.setProgram(p);
33   }
34
35private:
36   BuildUtil bld;
37
38   virtual bool visit(Instruction *);
39
40   bool handleDMNMX(Instruction *);
41   bool handleEXTBF(Instruction *);
42   bool handleFLOW(Instruction *);
43   bool handleI2I(Instruction *);
44   bool handleINSBF(Instruction *);
45   bool handlePINTERP(Instruction *);
46   bool handlePREFLOW(Instruction *);
47   bool handlePRESIN(Instruction *);
48};
49
50class GV100LegalizeSSA : public GM107LegalizeSSA
51{
52public:
53   GV100LegalizeSSA(Program *p) {
54      bld.setProgram(p);
55   }
56
57private:
58   virtual bool visit(Function *) { return true; }
59   virtual bool visit(BasicBlock *) { return true; }
60   virtual bool visit(Instruction *);
61
62   bool handleCMP(Instruction *);
63   bool handleIADD64(Instruction *);
64   bool handleIMAD_HIGH(Instruction *);
65   bool handleIMNMX(Instruction *);
66   bool handleIMUL(Instruction *);
67   bool handleLOP2(Instruction *);
68   bool handleNOT(Instruction *);
69   bool handlePREEX2(Instruction *);
70   bool handleQUADON(Instruction *);
71   bool handleQUADPOP(Instruction *);
72   bool handleSET(Instruction *);
73   bool handleSHFL(Instruction *);
74   bool handleShift(Instruction *);
75   bool handleSUB(Instruction *);
76};
77}
78#endif
79