blob: 24482c07524c3b70a824d99bbcd0c144a5ddcf4f [file] [log] [blame]
Jack Carter3a2c2d42013-08-13 20:54:07 +00001//===- MipsMSAInstrInfo.td - MSA 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 MSA ASE instructions.
11//
12//===----------------------------------------------------------------------===//
13
14// Instruction encoding.
15class LD_B_ENC : MSA_I5_FMT<0b110, 0b00, 0b000111>;
16class LD_H_ENC : MSA_I5_FMT<0b110, 0b01, 0b000111>;
17class LD_W_ENC : MSA_I5_FMT<0b110, 0b10, 0b000111>;
18class LD_D_ENC : MSA_I5_FMT<0b110, 0b11, 0b000111>;
19class ST_B_ENC : MSA_I5_FMT<0b111, 0b00, 0b000111>;
20class ST_H_ENC : MSA_I5_FMT<0b111, 0b01, 0b000111>;
21class ST_W_ENC : MSA_I5_FMT<0b111, 0b10, 0b000111>;
22class ST_D_ENC : MSA_I5_FMT<0b111, 0b11, 0b000111>;
23
24// Instruction desc.
25class LD_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
26 ValueType TyNode, InstrItinClass itin, RegisterClass RCWD,
27 Operand MemOpnd = mem, ComplexPattern Addr = addr> {
28 dag OutOperandList = (outs RCWD:$wd);
29 dag InOperandList = (ins MemOpnd:$addr);
30 string AsmString = !strconcat(instr_asm, "\t$wd, $addr");
31 list<dag> Pattern = [(set RCWD:$wd, (TyNode (OpNode Addr:$addr)))];
32 InstrItinClass Itinerary = itin;
33}
34
35class ST_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
36 ValueType TyNode, InstrItinClass itin, RegisterClass RCWD,
37 Operand MemOpnd = mem, ComplexPattern Addr = addr> {
38 dag OutOperandList = (outs);
39 dag InOperandList = (ins RCWD:$wd, MemOpnd:$addr);
40 string AsmString = !strconcat(instr_asm, "\t$wd, $addr");
41 list<dag> Pattern = [(OpNode (TyNode RCWD:$wd), Addr:$addr)];
42 InstrItinClass Itinerary = itin;
43}
44
45// Load/Store
46class LD_B_DESC : LD_DESC_BASE<"ld.b", load, v16i8, NoItinerary, MSA128>;
47class LD_H_DESC : LD_DESC_BASE<"ld.h", load, v8i16, NoItinerary, MSA128>;
48class LD_W_DESC : LD_DESC_BASE<"ld.w", load, v4i32, NoItinerary, MSA128>;
49class LD_D_DESC : LD_DESC_BASE<"ld.d", load, v2i64, NoItinerary, MSA128>;
50class ST_B_DESC : ST_DESC_BASE<"st.b", store, v16i8, NoItinerary, MSA128>;
51class ST_H_DESC : ST_DESC_BASE<"st.h", store, v8i16, NoItinerary, MSA128>;
52class ST_W_DESC : ST_DESC_BASE<"st.w", store, v4i32, NoItinerary, MSA128>;
53class ST_D_DESC : ST_DESC_BASE<"st.d", store, v2i64, NoItinerary, MSA128>;
54
55// Instruction defs.
56def LD_B: LD_B_ENC, LD_B_DESC, Requires<[HasMSA]>;
57def LD_H: LD_H_ENC, LD_H_DESC, Requires<[HasMSA]>;
58def LD_W: LD_W_ENC, LD_W_DESC, Requires<[HasMSA]>;
59def LD_D: LD_D_ENC, LD_D_DESC, Requires<[HasMSA]>;
60
61def ST_B: ST_B_ENC, ST_B_DESC, Requires<[HasMSA]>;
62def ST_H: ST_H_ENC, ST_H_DESC, Requires<[HasMSA]>;
63def ST_W: ST_W_ENC, ST_W_DESC, Requires<[HasMSA]>;
64def ST_D: ST_D_ENC, ST_D_DESC, Requires<[HasMSA]>;
65
66// Patterns.
67class MSAPat<dag pattern, dag result, Predicate pred = HasMSA> :
68 Pat<pattern, result>, Requires<[pred]>;
69