forked from OSchip/llvm-project
convert FP instructions to use an asmstring and operand list, allowing FP
programs to work on V8 again llvm-svn: 24761
This commit is contained in:
parent
bc7708c0e8
commit
6b669e2680
|
@ -89,12 +89,15 @@ class F3_2<bits<2> opVal, bits<6> op3val, dag ops, string asmstr> : F3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// floating-point
|
// floating-point
|
||||||
class F3_3<bits<2> opVal, bits<6> op3val, bits<9> opfval, string name> : F3 {
|
class F3_3<bits<2> opVal, bits<6> op3val, bits<9> opfval, dag ops,
|
||||||
|
string asmstr> : F3 {
|
||||||
bits<5> rs2;
|
bits<5> rs2;
|
||||||
|
|
||||||
|
dag OperandList = ops;
|
||||||
|
let AsmString = asmstr;
|
||||||
|
|
||||||
let op = opVal;
|
let op = opVal;
|
||||||
let op3 = op3val;
|
let op3 = op3val;
|
||||||
let Name = name;
|
|
||||||
|
|
||||||
let Inst{13-5} = opfval; // fp opcode
|
let Inst{13-5} = opfval; // fp opcode
|
||||||
let Inst{4-0} = rs2;
|
let Inst{4-0} = rs2;
|
||||||
|
|
|
@ -452,44 +452,85 @@ def WRri : F3_2<2, 0b110000,
|
||||||
"wr $b, $c, $dst">;
|
"wr $b, $c, $dst">;
|
||||||
|
|
||||||
// Convert Integer to Floating-point Instructions, p. 141
|
// Convert Integer to Floating-point Instructions, p. 141
|
||||||
def FITOS : F3_3<2, 0b110100, 0b011000100, "fitos">;
|
def FITOS : F3_3<2, 0b110100, 0b011000100,
|
||||||
def FITOD : F3_3<2, 0b110100, 0b011001000, "fitod">;
|
(ops FPRegs:$dst, FPRegs:$src),
|
||||||
|
"fitos $src, $dst">;
|
||||||
|
def FITOD : F3_3<2, 0b110100, 0b011001000,
|
||||||
|
(ops DFPRegs:$dst, DFPRegs:$src),
|
||||||
|
"fitod $src, $dst">;
|
||||||
|
|
||||||
// Convert Floating-point to Integer Instructions, p. 142
|
// Convert Floating-point to Integer Instructions, p. 142
|
||||||
def FSTOI : F3_3<2, 0b110100, 0b011010001, "fstoi">;
|
def FSTOI : F3_3<2, 0b110100, 0b011010001,
|
||||||
def FDTOI : F3_3<2, 0b110100, 0b011010010, "fdtoi">;
|
(ops FPRegs:$dst, FPRegs:$src),
|
||||||
|
"fstoi $src, $dst">;
|
||||||
|
def FDTOI : F3_3<2, 0b110100, 0b011010010,
|
||||||
|
(ops DFPRegs:$dst, DFPRegs:$src),
|
||||||
|
"fdtoi $src, $dst">;
|
||||||
|
|
||||||
// Convert between Floating-point Formats Instructions, p. 143
|
// Convert between Floating-point Formats Instructions, p. 143
|
||||||
def FSTOD : F3_3<2, 0b110100, 0b011001001, "fstod">;
|
def FSTOD : F3_3<2, 0b110100, 0b011001001,
|
||||||
def FDTOS : F3_3<2, 0b110100, 0b011000110, "fdtos">;
|
(ops DFPRegs:$dst, FPRegs:$src),
|
||||||
|
"fstod $src, $dst">;
|
||||||
|
def FDTOS : F3_3<2, 0b110100, 0b011000110,
|
||||||
|
(ops FPRegs:$dst, DFPRegs:$src),
|
||||||
|
"fdtos $src, $dst">;
|
||||||
|
|
||||||
// Floating-point Move Instructions, p. 144
|
// Floating-point Move Instructions, p. 144
|
||||||
def FMOVS : F3_3<2, 0b110100, 0b000000001, "fmovs">;
|
def FMOVS : F3_3<2, 0b110100, 0b000000001,
|
||||||
def FNEGS : F3_3<2, 0b110100, 0b000000101, "fnegs">;
|
(ops FPRegs:$dst, FPRegs:$src),
|
||||||
def FABSS : F3_3<2, 0b110100, 0b000001001, "fabss">;
|
"fmovs $src, $dst">;
|
||||||
|
def FNEGS : F3_3<2, 0b110100, 0b000000101,
|
||||||
|
(ops FPRegs:$dst, FPRegs:$src),
|
||||||
|
"fnegs $src, $dst">;
|
||||||
|
def FABSS : F3_3<2, 0b110100, 0b000001001,
|
||||||
|
(ops FPRegs:$dst, FPRegs:$src),
|
||||||
|
"fabss $src, $dst">;
|
||||||
|
|
||||||
// Floating-point Add and Subtract Instructions, p. 146
|
// Floating-point Add and Subtract Instructions, p. 146
|
||||||
def FADDS : F3_3<2, 0b110100, 0b001000001, "fadds">;
|
def FADDS : F3_3<2, 0b110100, 0b001000001,
|
||||||
def FADDD : F3_3<2, 0b110100, 0b001000010, "faddd">;
|
(ops FPRegs:$dst, FPRegs:$src1, FPRegs:$src2),
|
||||||
def FSUBS : F3_3<2, 0b110100, 0b001000101, "fsubs">;
|
"fadds $src1, $src2, $dst">;
|
||||||
def FSUBD : F3_3<2, 0b110100, 0b001000110, "fsubd">;
|
def FADDD : F3_3<2, 0b110100, 0b001000010,
|
||||||
|
(ops DFPRegs:$dst, DFPRegs:$src1, DFPRegs:$src2),
|
||||||
|
"faddd $src1, $src2, $dst">;
|
||||||
|
def FSUBS : F3_3<2, 0b110100, 0b001000101,
|
||||||
|
(ops FPRegs:$dst, FPRegs:$src1, FPRegs:$src2),
|
||||||
|
"fsubs $src1, $src2, $dst">;
|
||||||
|
def FSUBD : F3_3<2, 0b110100, 0b001000110,
|
||||||
|
(ops DFPRegs:$dst, DFPRegs:$src1, DFPRegs:$src2),
|
||||||
|
"fsubd $src1, $src2, $dst">;
|
||||||
|
|
||||||
// Floating-point Multiply and Divide Instructions, p. 147
|
// Floating-point Multiply and Divide Instructions, p. 147
|
||||||
def FMULS : F3_3<2, 0b110100, 0b001001001, "fmuls">;
|
def FMULS : F3_3<2, 0b110100, 0b001001001,
|
||||||
def FMULD : F3_3<2, 0b110100, 0b001001010, "fmuld">;
|
(ops FPRegs:$dst, FPRegs:$src1, FPRegs:$src2),
|
||||||
def FSMULD : F3_3<2, 0b110100, 0b001101001, "fsmuld">;
|
"fmuls $src1, $src2, $dst">;
|
||||||
def FDIVS : F3_3<2, 0b110100, 0b001001101, "fdivs">;
|
def FMULD : F3_3<2, 0b110100, 0b001001010,
|
||||||
def FDIVD : F3_3<2, 0b110100, 0b001001110, "fdivd">;
|
(ops DFPRegs:$dst, DFPRegs:$src1, DFPRegs:$src2),
|
||||||
|
"fmuld $src1, $src2, $dst">;
|
||||||
|
def FSMULD : F3_3<2, 0b110100, 0b001101001,
|
||||||
|
(ops DFPRegs:$dst, FPRegs:$src1, FPRegs:$src2),
|
||||||
|
"fsmuld $src1, $src2, $dst">;
|
||||||
|
def FDIVS : F3_3<2, 0b110100, 0b001001101,
|
||||||
|
(ops FPRegs:$dst, FPRegs:$src1, FPRegs:$src2),
|
||||||
|
"fdivs $src1, $src2, $dst">;
|
||||||
|
def FDIVD : F3_3<2, 0b110100, 0b001001110,
|
||||||
|
(ops DFPRegs:$dst, DFPRegs:$src1, DFPRegs:$src2),
|
||||||
|
"fdivd $src1, $src2, $dst">;
|
||||||
|
|
||||||
// Floating-point Compare Instructions, p. 148
|
// Floating-point Compare Instructions, p. 148
|
||||||
// Note: the 2nd template arg is different for these guys.
|
// Note: the 2nd template arg is different for these guys.
|
||||||
// Note 2: the result of a FCMP is not available until the 2nd cycle
|
// Note 2: the result of a FCMP is not available until the 2nd cycle
|
||||||
// after the instr is retired, but there is no interlock. This behavior
|
// after the instr is retired, but there is no interlock. This behavior
|
||||||
// is modelled as a delay slot.
|
// is modelled with a forced noop after the instruction.
|
||||||
let hasDelaySlot = 1 in {
|
def FCMPS : F3_3<2, 0b110101, 0b001010001,
|
||||||
def FCMPS : F3_3<2, 0b110101, 0b001010001, "fcmps">;
|
(ops FPRegs:$src1, FPRegs:$src2),
|
||||||
def FCMPD : F3_3<2, 0b110101, 0b001010010, "fcmpd">;
|
"fcmps $src1, $src2\n nop">;
|
||||||
def FCMPES : F3_3<2, 0b110101, 0b001010101, "fcmpes">;
|
def FCMPD : F3_3<2, 0b110101, 0b001010010,
|
||||||
def FCMPED : F3_3<2, 0b110101, 0b001010110, "fcmped">;
|
(ops DFPRegs:$src1, DFPRegs:$src2),
|
||||||
}
|
"fcmpd $src1, $src2\n nop">;
|
||||||
|
def FCMPES : F3_3<2, 0b110101, 0b001010101,
|
||||||
|
(ops FPRegs:$src1, FPRegs:$src2),
|
||||||
|
"fcmpes $src1, $src2\n nop">;
|
||||||
|
def FCMPED : F3_3<2, 0b110101, 0b001010110,
|
||||||
|
(ops DFPRegs:$src1, DFPRegs:$src2),
|
||||||
|
"fcmped $src1, $src2\n nop">;
|
||||||
|
|
Loading…
Reference in New Issue