R600/SI: Refactor VOP3 instruction definitions

llvm-svn: 213571
This commit is contained in:
Tom Stellard 2014-07-21 17:44:29 +00:00
parent e5a1cdab47
commit bda32c9e47
2 changed files with 52 additions and 21 deletions

View File

@ -57,6 +57,8 @@ class VOP3Common <dag outs, dag ins, string asm, list<dag> pattern> :
let hasSideEffects = 0;
let UseNamedOperandTable = 1;
let VOP3 = 1;
int Size = 8;
}
//===----------------------------------------------------------------------===//

View File

@ -284,18 +284,56 @@ class SIMCInstr <string pseudo, int subtarget> {
int Subtarget = subtarget;
}
class VOP3_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
VOP3Common <outs, ins, "", pattern>,
VOP <opName>,
SIMCInstr<opName, SISubtarget.NONE> {
let isPseudo = 1;
}
class VOP3_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName> :
VOP3 <op, outs, ins, asm, []>,
SIMCInstr<opName, SISubtarget.SI>;
multiclass VOP3_m <bits<9> op, dag outs, dag ins, string asm, list<dag> pattern,
string opName> {
def "" : VOP3Common <outs, ins, "", pattern>, VOP <opName>,
SIMCInstr<OpName, SISubtarget.NONE> {
let isPseudo = 1;
}
def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
def _si : VOP3 <op, outs, ins, asm, []>, SIMCInstr<opName, SISubtarget.SI>;
def _si : VOP3_Real_si <op, outs, ins, asm, opName>;
}
multiclass VOP3_1_m <bits<8> op, dag outs, dag ins, string asm,
list<dag> pattern, string opName> {
def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
let src1 = 0, src1_modifiers = 0, src2 = 0, src2_modifiers = 0 in {
def _si : VOP3_Real_si <
{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
outs, ins, asm, opName
>;
} // src1 = 0, src1_modifiers = 0, src2 = 0, src2_modifiers = 0
}
multiclass VOP3_2_m <bits<6> op, dag outs, dag ins, string asm,
list<dag> pattern, string opName, string revOp> {
def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
let src2 = 0, src2_modifiers = 0 in {
def _si : VOP3_Real_si <
{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
outs, ins, asm, opName>,
VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
} // src2 = 0, src2_modifiers = 0
}
// This must always be right before the operand being input modified.
def InputMods : OperandWithDefaultOps <i32, (ops (i32 0))> {
let PrintMethod = "printOperandAndMods";
@ -309,17 +347,11 @@ multiclass VOP1_Helper <bits<8> op, RegisterClass drc, RegisterClass src,
opName#"_e32 $dst, $src0", pattern
>, VOP <opName>;
def _e64 : VOP3 <
{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
defm _e64 : VOP3_1_m <
op,
(outs drc:$dst),
(ins InputMods:$src0_modifiers, src:$src0, i32imm:$clamp, i32imm:$omod),
opName#"_e64 $dst, $src0_modifiers, $clamp, $omod", []
>, VOP <opName> {
let src1 = 0;
let src1_modifiers = 0;
let src2 = 0;
let src2_modifiers = 0;
}
opName#"_e64 $dst, $src0_modifiers, $clamp, $omod", [], opName>;
}
multiclass VOP1_32 <bits<8> op, string opName, list<dag> pattern>
@ -341,17 +373,14 @@ multiclass VOP2_Helper <bits<6> op, RegisterClass vrc, RegisterClass arc,
opName#"_e32 $dst, $src0, $src1", pattern
>, VOP <opName>, VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
def _e64 : VOP3 <
{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
defm _e64 : VOP3_2_m <
op,
(outs vrc:$dst),
(ins InputMods:$src0_modifiers, arc:$src0,
InputMods:$src1_modifiers, arc:$src1,
i32imm:$clamp, i32imm:$omod),
opName#"_e64 $dst, $src0_modifiers, $src1_modifiers, $clamp, $omod", []
>, VOP <opName>, VOP2_REV<revOp#"_e64", !eq(revOp, opName)> {
let src2 = 0;
let src2_modifiers = 0;
}
opName#"_e64 $dst, $src0_modifiers, $src1_modifiers, $clamp, $omod", [],
opName, revOp>;
}
multiclass VOP2_32 <bits<6> op, string opName, list<dag> pattern,