xref: /freebsd/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrDFP.td (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1//===-- PPCInstrDFP.td - PowerPC Decimal Floating Point ----*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file describes the PowerPC Decimal Floating Point (DFP) instructions.
10//
11//===----------------------------------------------------------------------===//
12
13// We provide no scheduling info for the DFP instructions.
14// While they are not pseudo instructions we don't intend on scheduling them.
15let hasNoSchedulingInfo = 1 in {
16let mayRaiseFPException = 1, hasSideEffects = 0 in {
17
18let isCommutable = 1 in {
19defm DADD : XForm_28r<59, 2, (outs f8rc:$RST), (ins f8rc:$RA, f8rc:$RB),
20                      "dadd",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
21
22defm DADDQ : XForm_28r<63, 2, (outs fpairrc:$RST), (ins fpairrc:$RA, fpairrc:$RB),
23                       "daddq",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
24}
25
26defm DSUB : XForm_28r<59, 514, (outs f8rc:$RST), (ins f8rc:$RA, f8rc:$RB),
27                      "dsub",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
28
29defm DSUBQ : XForm_28r<63, 514, (outs fpairrc:$RST), (ins fpairrc:$RA, fpairrc:$RB),
30                       "dsubq",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
31
32let isCommutable = 1 in {
33defm DMUL : XForm_28r<59, 34, (outs f8rc:$RST), (ins f8rc:$RA, f8rc:$RB),
34                      "dmul",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
35
36defm DMULQ : XForm_28r<63, 34, (outs fpairrc:$RST), (ins fpairrc:$RA, fpairrc:$RB),
37                       "dmulq",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
38}
39
40defm DDIV : XForm_28r<59, 546, (outs f8rc:$RST), (ins f8rc:$RA, f8rc:$RB),
41                      "ddiv",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
42
43defm DDIVQ : XForm_28r<63, 546, (outs fpairrc:$RST), (ins fpairrc:$RA, fpairrc:$RB),
44                       "ddivq",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
45
46let isCompare = 1 in {
47  def DCMPU : XForm_17<59, 642, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
48                       "dcmpu $BF, $RA, $RB", IIC_FPCompare>;
49
50  def DCMPUQ : XForm_17<63, 642, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
51                        "dcmpuq $BF, $RA, $RB", IIC_FPCompare>;
52
53  def DCMPO : XForm_17<59, 130, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
54                       "dcmpo $BF, $RA, $RB", IIC_FPCompare>;
55
56  def DCMPOQ : XForm_17<63, 130, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
57                        "dcmpoq $BF, $RA, $RB", IIC_FPCompare>;
58}
59
60// 5.6.4 DFP Quantum Adjustment Instructions
61defm DQUAI: Z23Form_TE5_FRTB5_RMC2r<59, 67, (outs f8rc:$FRT),
62                                    (ins s5imm:$TE, f8rc:$FRB, u2imm:$RMC),
63                                    "dquai", "$TE, $FRT, $FRB, $RMC", []>;
64defm DQUAIQ: Z23Form_TE5_FRTB5_RMC2r<63, 67, (outs fpairrc:$FRT),
65                                     (ins s5imm:$TE, fpairrc:$FRB, u2imm:$RMC),
66                                     "dquaiq", "$TE, $FRT, $FRB, $RMC", []>;
67defm DQUA: Z23Form_FRTAB5_RMC2r<59, 3, (outs f8rc:$FRT),
68                                (ins f8rc:$FRA, f8rc:$FRB, u2imm:$RMC),
69                                "dqua", "$FRT, $FRA, $FRB, $RMC", []>;
70defm DQUAQ: Z23Form_FRTAB5_RMC2r<63, 3, (outs fpairrc:$FRT),
71                                 (ins fpairrc:$FRA, fpairrc:$FRB, u2imm:$RMC),
72                                 "dquaq", "$FRT, $FRA, $FRB, $RMC", []>;
73defm DRRND: Z23Form_FRTAB5_RMC2r<59, 35, (outs f8rc:$FRT),
74                                (ins f8rc:$FRA, f8rc:$FRB, u2imm:$RMC),
75                                "drrnd", "$FRT, $FRA, $FRB, $RMC", []>;
76defm DRRNDQ: Z23Form_FRTAB5_RMC2r<63, 35, (outs fpairrc:$FRT),
77                                 (ins f8rc:$FRA, fpairrc:$FRB, u2imm:$RMC),
78                                 "drrndq", "$FRT, $FRA, $FRB, $RMC", []>;
79defm DRINTX: Z23Form_FRTB5_R1_RMC2r<59, 99, (outs f8rc:$FRT),
80                                    (ins u1imm:$R, f8rc:$FRB, u2imm:$RMC),
81                                    "drintx", "$R, $FRT, $FRB, $RMC", []>;
82defm DRINTXQ: Z23Form_FRTB5_R1_RMC2r<63, 99, (outs fpairrc:$FRT),
83                                     (ins u1imm:$R, fpairrc:$FRB, u2imm:$RMC),
84                                     "drintxq", "$R, $FRT, $FRB, $RMC", []>;
85defm DRINTN: Z23Form_FRTB5_R1_RMC2r<59, 227, (outs f8rc:$FRT),
86                                    (ins u1imm:$R, f8rc:$FRB, u2imm:$RMC),
87                                    "drintn", "$R, $FRT, $FRB, $RMC", []>;
88defm DRINTNQ: Z23Form_FRTB5_R1_RMC2r<63, 227, (outs fpairrc:$FRT),
89                                     (ins u1imm:$R, fpairrc:$FRB, u2imm:$RMC),
90                                     "drintnq", "$R, $FRT, $FRB, $RMC", []>;
91
92// 5.6.5 DFP Conversion Instructions
93defm DCTDP: XForm_26r<59, 258, (outs f8rc:$RST), (ins f8rc:$RB),
94                      "dctdp", "$RST, $RB", IIC_FPGeneral, []>;
95defm DCTQPQ: XForm_26r<63, 258, (outs fpairrc:$RST), (ins f8rc:$RB),
96                       "dctqpq", "$RST, $RB", IIC_FPGeneral, []>;
97defm DRSP: XForm_26r<59, 770, (outs f8rc:$RST), (ins f8rc:$RB),
98                     "drsp", "$RST, $RB", IIC_FPGeneral, []>;
99defm DRDPQ: XForm_26r<63, 770, (outs fpairrc:$RST), (ins fpairrc:$RB),
100                      "drdpq", "$RST, $RB", IIC_FPGeneral, []>;
101defm DCFFIX: XForm_26r<59, 802, (outs f8rc:$RST), (ins f8rc:$RB),
102                       "dcffix", "$RST, $RB", IIC_FPGeneral, []>;
103defm DCFFIXQ: XForm_26r<63, 802, (outs fpairrc:$RST), (ins f8rc:$RB),
104                        "dcffixq", "$RST, $RB", IIC_FPGeneral, []>;
105defm DCTFIX: XForm_26r<59, 290, (outs f8rc:$RST), (ins f8rc:$RB),
106                       "dctfix", "$RST, $RB", IIC_FPGeneral, []>;
107defm DCTFIXQ: XForm_26r<63, 290, (outs f8rc:$RST), (ins fpairrc:$RB),
108                        "dctfixq", "$RST, $RB", IIC_FPGeneral, []>;
109let Predicates = [HasP10Vector] in {
110  def DCFFIXQQ: XForm_26<63, 994, (outs fpairrc:$RST), (ins vrrc:$RB),
111                         "dcffixqq $RST, $RB", IIC_FPGeneral, []>;
112let RA = 1 in
113  def DCTFIXQQ: XForm_base_r3xo<63, 994, (outs vrrc:$RST), (ins fpairrc:$RB),
114                                "dctfixqq $RST, $RB", IIC_FPGeneral, []>;
115} // HasP10Vector
116
117// 5.6.6 DFP Format Instructions
118defm DENBCD: XForm_S1_FRTB5r<59, 834, (outs f8rc:$FRT),
119                              (ins u1imm:$S, f8rc:$FRB),
120                              "denbcd", "$S, $FRT, $FRB", []>;
121defm DENBCDQ: XForm_S1_FRTB5r<63, 834, (outs fpairrc:$FRT),
122                               (ins u1imm:$S, fpairrc:$FRB),
123                               "denbcdq", "$S, $FRT, $FRB", []>;
124} // mayRaiseFPException
125
126// 5.6.6 DFP none exception raising format instructions.
127defm DDEDPD: XForm_SP2_FRTB5r<59, 322, (outs f8rc:$FRT),
128                              (ins u2imm:$SP, f8rc:$FRB),
129                              "ddedpd", "$SP, $FRT, $FRB", []>;
130defm DDEDPDQ: XForm_SP2_FRTB5r<63, 322, (outs fpairrc:$FRT),
131                               (ins u2imm:$SP, fpairrc:$FRB),
132                               "ddedpdq", "$SP, $FRT, $FRB", []>;
133defm DXEX: XForm_26r<59, 354, (outs f8rc:$RST), (ins f8rc:$RB),
134                     "dxex", "$RST, $RB", NoItinerary, []>;
135defm DXEXQ: XForm_26r<63, 354, (outs f8rc:$RST), (ins fpairrc:$RB),
136                      "dxexq", "$RST, $RB", NoItinerary, []>;
137defm DIEX: XForm_base_r3xo_r<59, 866, (outs f8rc:$RST),
138                             (ins f8rc:$RA, f8rc:$RB),
139                             "diex", "$RST, $RA, $RB", []>;
140defm DIEXQ: XForm_base_r3xo_r<63, 866, (outs fpairrc:$RST),
141                              (ins f8rc:$RA, fpairrc:$RB),
142                              "diexq", "$RST, $RA, $RB", []>;
143defm DSCLI: Z22Form_FRTA5_SH6r<59, 66, (outs f8rc:$FRT),
144                               (ins f8rc:$FRA, u6imm:$SH),
145                               "dscli", "$FRT, $FRA, $SH", []>;
146defm DSCLIQ: Z22Form_FRTA5_SH6r<63, 66, (outs fpairrc:$FRT),
147                                (ins fpairrc:$FRA, u6imm:$SH),
148                                "dscliq", "$FRT, $FRA, $SH", []>;
149defm DSCRI: Z22Form_FRTA5_SH6r<59, 98, (outs f8rc:$FRT),
150                               (ins f8rc:$FRA, u6imm:$SH),
151                               "dscri", "$FRT, $FRA, $SH", []>;
152defm DSCRIQ: Z22Form_FRTA5_SH6r<63, 98, (outs fpairrc:$FRT),
153                                (ins fpairrc:$FRA, u6imm:$SH),
154                                "dscriq", "$FRT, $FRA, $SH", []>;
155
156// 5.6.3 DFP Test Instructions
157def DTSTDC : Z22Form_BF3_FRA5_DCM6<59, 194, (outs crrc:$BF),
158                                   (ins f8rc:$FRA, u6imm:$DCM),
159                                   "dtstdc $BF, $FRA, $DCM", IIC_FPCompare, []>;
160
161def DTSTDCQ : Z22Form_BF3_FRA5_DCM6<63, 194, (outs crrc:$BF),
162                                    (ins fpairrc:$FRA, u6imm:$DCM),
163                                    "dtstdcq $BF, $FRA, $DCM", IIC_FPCompare, []>;
164
165def DTSTDG : Z22Form_BF3_FRA5_DCM6<59, 226, (outs crrc:$BF),
166                                   (ins f8rc:$FRA, u6imm:$DCM),
167                                   "dtstdg $BF, $FRA, $DCM", IIC_FPCompare, []>;
168
169def DTSTDGQ : Z22Form_BF3_FRA5_DCM6<63, 226, (outs crrc:$BF),
170                                    (ins fpairrc:$FRA, u6imm:$DCM),
171                                    "dtstdgq $BF, $FRA, $DCM", IIC_FPCompare, []>;
172
173def DTSTEX : XForm_17<59, 162, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
174                      "dtstex $BF, $RA, $RB", IIC_FPCompare>;
175
176def DTSTEXQ : XForm_17<63, 162, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
177                       "dtstexq $BF, $RA, $RB", IIC_FPCompare>;
178
179def DTSTSF : XForm_17<59, 674, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
180                      "dtstsf $BF, $RA, $RB", IIC_FPCompare>;
181
182def DTSTSFQ : XForm_17<63, 674, (outs crrc:$BF), (ins f8rc:$RA, fpairrc:$RB),
183                       "dtstsfq $BF, $RA, $RB", IIC_FPCompare>;
184
185def DTSTSFI : XForm_BF3_UIM6_FRB5<59, 675, (outs crrc:$BF),
186                                  (ins u6imm:$UIM, f8rc:$FRB),
187                                  "dtstsfi $BF, $UIM, $FRB", IIC_FPCompare, []>;
188
189def DTSTSFIQ : XForm_BF3_UIM6_FRB5<63, 675, (outs crrc:$BF),
190                                   (ins u6imm:$UIM, fpairrc:$FRB),
191                                   "dtstsfiq $BF, $UIM, $FRB", IIC_FPCompare, []>;
192
193} // hasNoSchedulingInfo
194