MIPS DSP: add vector load/store patterns.
[oota-llvm.git] / lib / Target / Mips / MipsDSPInstrInfo.td
1 //===- MipsDSPInstrInfo.td - DSP ASE instructions -*- 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 Mips DSP ASE instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 // ImmLeaf
15 def immZExt2 : ImmLeaf<i32, [{return isUInt<2>(Imm);}]>;
16 def immZExt3 : ImmLeaf<i32, [{return isUInt<3>(Imm);}]>;
17 def immZExt4 : ImmLeaf<i32, [{return isUInt<4>(Imm);}]>;
18 def immZExt8 : ImmLeaf<i32, [{return isUInt<8>(Imm);}]>;
19 def immZExt10 : ImmLeaf<i32, [{return isUInt<10>(Imm);}]>;
20 def immSExt6 : ImmLeaf<i32, [{return isInt<6>(Imm);}]>;
21
22 // Patterns.
23 class DSPPat<dag pattern, dag result, Predicate pred = HasDSP> :
24   Pat<pattern, result>, Requires<[pred]>;
25
26 def : DSPPat<(v2i16 (load addr:$a)),
27              (v2i16 (COPY_TO_REGCLASS (LW addr:$a), DSPRegs))>;
28 def : DSPPat<(v4i8 (load addr:$a)),
29              (v4i8 (COPY_TO_REGCLASS (LW addr:$a), DSPRegs))>;
30 def : DSPPat<(store (v2i16 DSPRegs:$val), addr:$a),
31              (SW (COPY_TO_REGCLASS DSPRegs:$val, CPURegs), addr:$a)>;
32 def : DSPPat<(store (v4i8 DSPRegs:$val), addr:$a),
33              (SW (COPY_TO_REGCLASS DSPRegs:$val, CPURegs), addr:$a)>;