diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-12-13 01:07:37 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-12-13 01:07:37 +0000 |
commit | 82fdad75f7efa9d15261068e1bb3691f10fb3d36 (patch) | |
tree | 25425e67d6207381a38ac7ad5a0ec08615b84c8b /lib/Target/Mips/MipsInstrFPU.td | |
parent | fcc934322bc6e0b89df8fbcdde59145f5af1179a (diff) | |
download | external_llvm-82fdad75f7efa9d15261068e1bb3691f10fb3d36.zip external_llvm-82fdad75f7efa9d15261068e1bb3691f10fb3d36.tar.gz external_llvm-82fdad75f7efa9d15261068e1bb3691f10fb3d36.tar.bz2 |
[mips] Modify definitions of three register operand floating point instructions
and separate encoding information from the rest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsInstrFPU.td')
-rw-r--r-- | lib/Target/Mips/MipsInstrFPU.td | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/Target/Mips/MipsInstrFPU.td b/lib/Target/Mips/MipsInstrFPU.td index d38584c..e6fd1d6 100644 --- a/lib/Target/Mips/MipsInstrFPU.td +++ b/lib/Target/Mips/MipsInstrFPU.td @@ -182,6 +182,24 @@ class FNMADDSUB<bits<3> funct, bits<3> fmt, string opstr, !strconcat(opstr, "\t$fd, $fr, $fs, $ft"), [(set RC:$fd, (fsub fpimm0, (OpNode (fmul RC:$fs, RC:$ft), RC:$fr)))]>; +class ADDS_FT<string opstr, RegisterClass RC, InstrItinClass Itin, bit IsComm, + SDPatternOperator OpNode= null_frag> : + InstSE<(outs RC:$fd), (ins RC:$fs, RC:$ft), + !strconcat(opstr, "\t$fd, $fs, $ft"), + [(set RC:$fd, (OpNode RC:$fs, RC:$ft))], Itin, FrmFR> { + let isCommutable = IsComm; +} + +multiclass ADDS_M<string opstr, InstrItinClass Itin, bit IsComm, + SDPatternOperator OpNode = null_frag> { + def _D32 : ADDS_FT<opstr, AFGR64, Itin, IsComm, OpNode>, + Requires<[NotFP64bit, HasStdEnc]>; + def _D64 : ADDS_FT<opstr, FGR64, Itin, IsComm, OpNode>, + Requires<[IsFP64bit, HasStdEnc]> { + string DecoderNamespace = "Mips64"; + } +} + //===----------------------------------------------------------------------===// // Floating Point Instructions //===----------------------------------------------------------------------===// @@ -345,14 +363,14 @@ let Predicates = [HasMips64, HasStdEnc], } /// Floating-point Aritmetic -def FADD_S : FFR2P<0x00, 16, "add.s", FGR32, fadd>, IsCommutable; -defm FADD : FFR2P_M<0x00, "add.d", fadd>, IsCommutable; -def FDIV_S : FFR2P<0x03, 16, "div.s", FGR32, fdiv>; -defm FDIV : FFR2P_M<0x03, "div.d", fdiv>; -def FMUL_S : FFR2P<0x02, 16, "mul.s", FGR32, fmul>, IsCommutable; -defm FMUL : FFR2P_M<0x02, "mul.d", fmul>, IsCommutable; -def FSUB_S : FFR2P<0x01, 16, "sub.s", FGR32, fsub>; -defm FSUB : FFR2P_M<0x01, "sub.d", fsub>; +def FADD_S : ADDS_FT<"add.s", FGR32, IIFadd, 1, fadd>, ADDS_FM<0x00, 16>; +defm FADD : ADDS_M<"add.d", IIFadd, 1, fadd>, ADDS_FM<0x00, 17>; +def FDIV_S : ADDS_FT<"div.s", FGR32, IIFdivSingle, 0, fdiv>, ADDS_FM<0x03, 16>; +defm FDIV : ADDS_M<"div.d", IIFdivDouble, 0, fdiv>, ADDS_FM<0x03, 17>; +def FMUL_S : ADDS_FT<"mul.s", FGR32, IIFmulSingle, 1, fmul>, ADDS_FM<0x02, 16>; +defm FMUL : ADDS_M<"mul.d", IIFmulDouble, 1, fmul>, ADDS_FM<0x02, 17>; +def FSUB_S : ADDS_FT<"sub.s", FGR32, IIFadd, 0, fsub>, ADDS_FM<0x01, 16>; +defm FSUB : ADDS_M<"sub.d", IIFadd, 0, fsub>, ADDS_FM<0x01, 17>; let Predicates = [HasMips32r2, HasStdEnc] in { def MADD_S : FMADDSUB<0x4, 0, "madd.s", fadd, FGR32>; |