[Hexagon] Since decoding conflicts have been resolved, isCodeGenOnly = 0 by default...
[oota-llvm.git] / lib / Target / Hexagon / HexagonInstrInfoVector.td
1 //===- HexagonInstrInfoVector.td - Hexagon Vector Patterns -*- tablegen -*-===//
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 // This file describes the Hexagon Vector instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 def V2I1:  PatLeaf<(v2i1  PredRegs:$R)>;
15 def V4I1:  PatLeaf<(v4i1  PredRegs:$R)>;
16 def V8I1:  PatLeaf<(v8i1  PredRegs:$R)>;
17 def V4I8:  PatLeaf<(v4i8  IntRegs:$R)>;
18 def V2I16: PatLeaf<(v2i16 IntRegs:$R)>;
19 def V8I8:  PatLeaf<(v8i8  DoubleRegs:$R)>;
20 def V4I16: PatLeaf<(v4i16 DoubleRegs:$R)>;
21 def V2I32: PatLeaf<(v2i32 DoubleRegs:$R)>;
22
23 // Vector shift support. Vector shifting in Hexagon is rather different
24 // from internal representation of LLVM.
25 // LLVM assumes all shifts (in vector case) will have the form
26 // <VT> = SHL/SRA/SRL <VT> by <VT>
27 // while Hexagon has the following format:
28 // <VT> = SHL/SRA/SRL <VT> by <IT/i32>
29 // As a result, special care is needed to guarantee correctness and
30 // performance.
31 class vshift_v4i16<SDNode Op, string Str, bits<3>MajOp, bits<3>MinOp>
32   : S_2OpInstImm<Str, MajOp, MinOp, u4Imm,
33       [(set (v4i16 DoubleRegs:$dst),
34             (Op (v4i16 DoubleRegs:$src1), u4ImmPred:$src2))]> {
35   bits<4> src2;
36   let Inst{11-8} = src2;
37 }
38
39 class vshift_v2i32<SDNode Op, string Str, bits<3>MajOp, bits<3>MinOp>
40   : S_2OpInstImm<Str, MajOp, MinOp, u5Imm,
41       [(set (v2i32 DoubleRegs:$dst),
42             (Op (v2i32 DoubleRegs:$src1), u5ImmPred:$src2))]> {
43   bits<5> src2;
44   let Inst{12-8} = src2;
45 }
46
47 def S2_asr_i_vw : vshift_v2i32<sra, "vasrw", 0b010, 0b000>;
48 def S2_lsr_i_vw : vshift_v2i32<srl, "vlsrw", 0b010, 0b001>;
49 def S2_asl_i_vw : vshift_v2i32<shl, "vaslw", 0b010, 0b010>;
50
51 def S2_asr_i_vh : vshift_v4i16<sra, "vasrh", 0b100, 0b000>;
52 def S2_lsr_i_vh : vshift_v4i16<srl, "vlsrh", 0b100, 0b001>;
53 def S2_asl_i_vh : vshift_v4i16<shl, "vaslh", 0b100, 0b010>;
54
55 // Vector shift words by register
56 def S2_asr_r_vw : T_S3op_shiftVect < "vasrw", 0b00, 0b00>;
57 def S2_lsr_r_vw : T_S3op_shiftVect < "vlsrw", 0b00, 0b01>;
58 def S2_asl_r_vw : T_S3op_shiftVect < "vaslw", 0b00, 0b10>;
59 def S2_lsl_r_vw : T_S3op_shiftVect < "vlslw", 0b00, 0b11>;
60
61 // Vector shift halfwords by register
62 def S2_asr_r_vh : T_S3op_shiftVect < "vasrh", 0b01, 0b00>;
63 def S2_lsr_r_vh : T_S3op_shiftVect < "vlsrh", 0b01, 0b01>;
64 def S2_asl_r_vh : T_S3op_shiftVect < "vaslh", 0b01, 0b10>;
65 def S2_lsl_r_vh : T_S3op_shiftVect < "vlslh", 0b01, 0b11>;