aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorLei Huang <lei@ca.ibm.com>2023-07-04 13:43:52 -0400
committerLei Huang <lei@ca.ibm.com>2023-07-04 15:10:37 -0400
commitd22918484e7769fd8667a64a7df662b6de6bde6c (patch)
tree5ee0e76a2f7284c87ca118f56492ae35170416f6 /llvm/lib
parenta16797699e6f8a90a315d8b895da271854a0888e (diff)
downloadllvm-d22918484e7769fd8667a64a7df662b6de6bde6c.zip
llvm-d22918484e7769fd8667a64a7df662b6de6bde6c.tar.gz
llvm-d22918484e7769fd8667a64a7df662b6de6bde6c.tar.bz2
[PowerPC] Add DFP quantum adjustment instruction definitions and MC tests
Add td definitions and asm/disasm tests for the quantum adjustment instructions in ISA 3.1 section 5.6.4 Reviewed By: stefanp Differential Revision: https://reviews.llvm.org/D154369
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/PowerPC/PPCInstrDFP.td37
-rw-r--r--llvm/lib/Target/PowerPC/PPCInstrFormats.td48
-rw-r--r--llvm/lib/Target/PowerPC/PPCInstrInfo.td47
3 files changed, 130 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrDFP.td b/llvm/lib/Target/PowerPC/PPCInstrDFP.td
index 01193c5..3459e62 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrDFP.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrDFP.td
@@ -56,6 +56,39 @@ let isCompare = 1 in {
def DCMPOQ : XForm_17<63, 130, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
"dcmpoq $BF, $RA, $RB", IIC_FPCompare>;
}
-}
-}
+
+// 5.6.4 DFP Quantum Adjustment Instructions
+defm DQUAI: Z23Form_TE5_FRTB5_RMC2r<59, 67, (outs f8rc:$FRT),
+ (ins s5imm:$TE, f8rc:$FRB, u2imm:$RMC),
+ "dquai", "$TE, $FRT, $FRB, $RMC", []>;
+defm DQUAIQ: Z23Form_TE5_FRTB5_RMC2r<63, 67, (outs fpairrc:$FRT),
+ (ins s5imm:$TE, fpairrc:$FRB, u2imm:$RMC),
+ "dquaiq", "$TE, $FRT, $FRB, $RMC", []>;
+defm DQUA: Z23Form_FRTAB5_RMC2r<59, 3, (outs f8rc:$FRT),
+ (ins f8rc:$FRA, f8rc:$FRB, u2imm:$RMC),
+ "dqua", "$FRT, $FRA, $FRB, $RMC", []>;
+defm DQUAQ: Z23Form_FRTAB5_RMC2r<63, 3, (outs fpairrc:$FRT),
+ (ins fpairrc:$FRA, fpairrc:$FRB, u2imm:$RMC),
+ "dquaq", "$FRT, $FRA, $FRB, $RMC", []>;
+defm DRRND: Z23Form_FRTAB5_RMC2r<59, 35, (outs f8rc:$FRT),
+ (ins f8rc:$FRA, f8rc:$FRB, u2imm:$RMC),
+ "drrnd", "$FRT, $FRA, $FRB, $RMC", []>;
+defm DRRNDQ: Z23Form_FRTAB5_RMC2r<63, 35, (outs fpairrc:$FRT),
+ (ins f8rc:$FRA, fpairrc:$FRB, u2imm:$RMC),
+ "drrndq", "$FRT, $FRA, $FRB, $RMC", []>;
+defm DRINTX: Z23Form_FRTB5_R1_RMC2r<59, 99, (outs f8rc:$FRT),
+ (ins u1imm:$R, f8rc:$FRB, u2imm:$RMC),
+ "drintx", "$R, $FRT, $FRB, $RMC", []>;
+defm DRINTXQ: Z23Form_FRTB5_R1_RMC2r<63, 99, (outs fpairrc:$FRT),
+ (ins u1imm:$R, fpairrc:$FRB, u2imm:$RMC),
+ "drintxq", "$R, $FRT, $FRB, $RMC", []>;
+defm DRINTN: Z23Form_FRTB5_R1_RMC2r<59, 227, (outs f8rc:$FRT),
+ (ins u1imm:$R, f8rc:$FRB, u2imm:$RMC),
+ "drintn", "$R, $FRT, $FRB, $RMC", []>;
+defm DRINTNQ: Z23Form_FRTB5_R1_RMC2r<63, 227, (outs fpairrc:$FRT),
+ (ins u1imm:$R, fpairrc:$FRB, u2imm:$RMC),
+ "drintnq", "$R, $FRT, $FRB, $RMC", []>;
+
+} // mayRaiseFPException
+} // hasNoSchedulingInfo
diff --git a/llvm/lib/Target/PowerPC/PPCInstrFormats.td b/llvm/lib/Target/PowerPC/PPCInstrFormats.td
index dfa9fe1..a52cf68 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrFormats.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrFormats.td
@@ -2171,6 +2171,54 @@ class Z23Form_RTAB5_CY2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
let Inst{31} = 0;
}
+class Z23Form_FRTAB5_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmstr, list<dag> pattern>
+ : I<opcode, OOL, IOL, asmstr, NoItinerary> {
+ bits<5> FRT;
+ bits<5> FRA;
+ bits<5> FRB;
+ bits<2> RMC;
+
+ let Pattern = pattern;
+
+ bit RC = 0; // set by isRecordForm
+
+ let Inst{6 - 10} = FRT;
+ let Inst{11 - 15} = FRA;
+ let Inst{16 - 20} = FRB;
+ let Inst{21 - 22} = RMC;
+ let Inst{23 - 30} = xo;
+ let Inst{31} = RC;
+}
+
+class Z23Form_TE5_FRTB5_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmstr, list<dag> pattern>
+ : Z23Form_FRTAB5_RMC2<opcode, xo, OOL, IOL, asmstr, pattern> {
+ bits<5> TE;
+ let FRA = TE;
+}
+
+class Z23Form_FRTB5_R1_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmstr, list<dag> pattern>
+ : I<opcode, OOL, IOL, asmstr, NoItinerary> {
+ bits<5> FRT;
+ bits<1> R;
+ bits<5> FRB;
+ bits<2> RMC;
+
+ let Pattern = pattern;
+
+ bit RC = 0; // set by isRecordForm
+
+ let Inst{6 - 10} = FRT;
+ let Inst{11 - 14} = 0;
+ let Inst{15} = R;
+ let Inst{16 - 20} = FRB;
+ let Inst{21 - 22} = RMC;
+ let Inst{23 - 30} = xo;
+ let Inst{31} = RC;
+}
+
//===----------------------------------------------------------------------===//
// EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
// stuff
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 25b2f9b..d95fc9b 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -1085,6 +1085,53 @@ multiclass AForm_3r<bits<6> opcode, bits<5> xo, dag OOL, dag IOL,
}
}
+multiclass
+ Z23Form_TE5_FRTB5_RMC2r<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmbase, string asmstr, list<dag> pattern> {
+ let BaseName = asmbase in {
+ def NAME
+ : Z23Form_TE5_FRTB5_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(" ", asmstr)),
+ pattern>, RecFormRel;
+ let Defs = [CR0] in
+ def _rec : Z23Form_TE5_FRTB5_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(". ", asmstr)),
+ []>, isRecordForm, RecFormRel;
+ }
+}
+
+multiclass
+ Z23Form_FRTAB5_RMC2r<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmbase, string asmstr, list<dag> pattern> {
+ let BaseName = asmbase in {
+ def NAME : Z23Form_FRTAB5_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(" ", asmstr)),
+ pattern>, RecFormRel;
+ let Defs = [CR1] in
+ def _rec : Z23Form_FRTAB5_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(". ", asmstr)),
+ []>, isRecordForm, RecFormRel;
+ }
+}
+
+multiclass
+ Z23Form_FRTB5_R1_RMC2r<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+ string asmbase, string asmstr, list<dag> pattern> {
+ let BaseName = asmbase in {
+ def NAME : Z23Form_FRTB5_R1_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(" ", asmstr)),
+ pattern>, RecFormRel;
+ let Defs = [CR1] in
+ def _rec : Z23Form_FRTB5_R1_RMC2<opcode, xo, OOL, IOL,
+ !strconcat(asmbase, !strconcat(". ", asmstr)),
+ []>, isRecordForm, RecFormRel;
+ }
+}
+
+//===----------------------------------------------------------------------===//
+// END OF MULTICLASS DEFINITIONS
+//===----------------------------------------------------------------------===//
+
//===----------------------------------------------------------------------===//
// PowerPC Instruction Definitions.