1 //==- SystemZInstrHFP.td - Floating-point SystemZ instructions -*- tblgen-*-==//
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
7 //===----------------------------------------------------------------------===//
9 // The instructions in this file implement SystemZ hexadecimal floating-point
10 // arithmetic. Since this format is not mapped to any source-language data
11 // type, these instructions are not used for code generation, but are provided
12 // for use with the assembler and disassembler only.
14 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
18 //===----------------------------------------------------------------------===//
22 def LTER : UnaryRR <"lter", 0x32, null_frag, FP32, FP32>;
23 def LTDR : UnaryRR <"ltdr", 0x22, null_frag, FP64, FP64>;
24 def LTXR : UnaryRRE<"ltxr", 0xB362, null_frag, FP128, FP128>;
27 //===----------------------------------------------------------------------===//
28 // Conversion instructions
29 //===----------------------------------------------------------------------===//
31 // Convert floating-point values to narrower representations.
32 def LEDR : UnaryRR <"ledr", 0x35, null_frag, FP32, FP64>;
33 def LEXR : UnaryRRE<"lexr", 0xB366, null_frag, FP32, FP128>;
34 def LDXR : UnaryRR <"ldxr", 0x25, null_frag, FP64, FP128>;
35 let isAsmParserOnly = 1 in {
36 def LRER : UnaryRR <"lrer", 0x35, null_frag, FP32, FP64>;
37 def LRDR : UnaryRR <"lrdr", 0x25, null_frag, FP64, FP128>;
40 // Extend floating-point values to wider representations.
41 def LDER : UnaryRRE<"lder", 0xB324, null_frag, FP64, FP32>;
42 def LXER : UnaryRRE<"lxer", 0xB326, null_frag, FP128, FP32>;
43 def LXDR : UnaryRRE<"lxdr", 0xB325, null_frag, FP128, FP64>;
45 def LDE : UnaryRXE<"lde", 0xED24, null_frag, FP64, 4>;
46 def LXE : UnaryRXE<"lxe", 0xED26, null_frag, FP128, 4>;
47 def LXD : UnaryRXE<"lxd", 0xED25, null_frag, FP128, 8>;
49 // Convert a signed integer register value to a floating-point one.
50 def CEFR : UnaryRRE<"cefr", 0xB3B4, null_frag, FP32, GR32>;
51 def CDFR : UnaryRRE<"cdfr", 0xB3B5, null_frag, FP64, GR32>;
52 def CXFR : UnaryRRE<"cxfr", 0xB3B6, null_frag, FP128, GR32>;
54 def CEGR : UnaryRRE<"cegr", 0xB3C4, null_frag, FP32, GR64>;
55 def CDGR : UnaryRRE<"cdgr", 0xB3C5, null_frag, FP64, GR64>;
56 def CXGR : UnaryRRE<"cxgr", 0xB3C6, null_frag, FP128, GR64>;
58 // Convert a floating-point register value to a signed integer value,
59 // with the second operand (modifier M3) specifying the rounding mode.
61 def CFER : BinaryRRFe<"cfer", 0xB3B8, GR32, FP32>;
62 def CFDR : BinaryRRFe<"cfdr", 0xB3B9, GR32, FP64>;
63 def CFXR : BinaryRRFe<"cfxr", 0xB3BA, GR32, FP128>;
65 def CGER : BinaryRRFe<"cger", 0xB3C8, GR64, FP32>;
66 def CGDR : BinaryRRFe<"cgdr", 0xB3C9, GR64, FP64>;
67 def CGXR : BinaryRRFe<"cgxr", 0xB3CA, GR64, FP128>;
70 // Convert BFP to HFP.
72 def THDER : UnaryRRE<"thder", 0xB358, null_frag, FP64, FP32>;
73 def THDR : UnaryRRE<"thdr", 0xB359, null_frag, FP64, FP64>;
76 // Convert HFP to BFP.
78 def TBEDR : BinaryRRFe<"tbedr", 0xB350, FP32, FP64>;
79 def TBDR : BinaryRRFe<"tbdr", 0xB351, FP64, FP64>;
83 //===----------------------------------------------------------------------===//
85 //===----------------------------------------------------------------------===//
87 // Negation (Load Complement).
89 def LCER : UnaryRR <"lcer", 0x33, null_frag, FP32, FP32>;
90 def LCDR : UnaryRR <"lcdr", 0x23, null_frag, FP64, FP64>;
91 def LCXR : UnaryRRE<"lcxr", 0xB363, null_frag, FP128, FP128>;
94 // Absolute value (Load Positive).
96 def LPER : UnaryRR <"lper", 0x30, null_frag, FP32, FP32>;
97 def LPDR : UnaryRR <"lpdr", 0x20, null_frag, FP64, FP64>;
98 def LPXR : UnaryRRE<"lpxr", 0xB360, null_frag, FP128, FP128>;
101 // Negative absolute value (Load Negative).
103 def LNER : UnaryRR <"lner", 0x31, null_frag, FP32, FP32>;
104 def LNDR : UnaryRR <"lndr", 0x21, null_frag, FP64, FP64>;
105 def LNXR : UnaryRRE<"lnxr", 0xB361, null_frag, FP128, FP128>;
109 def HER : UnaryRR <"her", 0x34, null_frag, FP32, FP32>;
110 def HDR : UnaryRR <"hdr", 0x24, null_frag, FP64, FP64>;
113 def SQER : UnaryRRE<"sqer", 0xB245, null_frag, FP32, FP32>;
114 def SQDR : UnaryRRE<"sqdr", 0xB244, null_frag, FP64, FP64>;
115 def SQXR : UnaryRRE<"sqxr", 0xB336, null_frag, FP128, FP128>;
117 def SQE : UnaryRXE<"sqe", 0xED34, null_frag, FP32, 4>;
118 def SQD : UnaryRXE<"sqd", 0xED35, null_frag, FP64, 8>;
120 // Round to an integer (rounding towards zero).
121 def FIER : UnaryRRE<"fier", 0xB377, null_frag, FP32, FP32>;
122 def FIDR : UnaryRRE<"fidr", 0xB37F, null_frag, FP64, FP64>;
123 def FIXR : UnaryRRE<"fixr", 0xB367, null_frag, FP128, FP128>;
126 //===----------------------------------------------------------------------===//
128 //===----------------------------------------------------------------------===//
132 let isCommutable = 1 in {
133 def AER : BinaryRR<"aer", 0x3A, null_frag, FP32, FP32>;
134 def ADR : BinaryRR<"adr", 0x2A, null_frag, FP64, FP64>;
135 def AXR : BinaryRR<"axr", 0x36, null_frag, FP128, FP128>;
137 def AE : BinaryRX<"ae", 0x7A, null_frag, FP32, load, 4>;
138 def AD : BinaryRX<"ad", 0x6A, null_frag, FP64, load, 8>;
141 // Addition (unnormalized).
143 let isCommutable = 1 in {
144 def AUR : BinaryRR<"aur", 0x3E, null_frag, FP32, FP32>;
145 def AWR : BinaryRR<"awr", 0x2E, null_frag, FP64, FP64>;
147 def AU : BinaryRX<"au", 0x7E, null_frag, FP32, load, 4>;
148 def AW : BinaryRX<"aw", 0x6E, null_frag, FP64, load, 8>;
153 def SER : BinaryRR<"ser", 0x3B, null_frag, FP32, FP32>;
154 def SDR : BinaryRR<"sdr", 0x2B, null_frag, FP64, FP64>;
155 def SXR : BinaryRR<"sxr", 0x37, null_frag, FP128, FP128>;
157 def SE : BinaryRX<"se", 0x7B, null_frag, FP32, load, 4>;
158 def SD : BinaryRX<"sd", 0x6B, null_frag, FP64, load, 8>;
161 // Subtraction (unnormalized).
163 def SUR : BinaryRR<"sur", 0x3F, null_frag, FP32, FP32>;
164 def SWR : BinaryRR<"swr", 0x2F, null_frag, FP64, FP64>;
166 def SU : BinaryRX<"su", 0x7F, null_frag, FP32, load, 4>;
167 def SW : BinaryRX<"sw", 0x6F, null_frag, FP64, load, 8>;
171 let isCommutable = 1 in {
172 def MEER : BinaryRRE<"meer", 0xB337, null_frag, FP32, FP32>;
173 def MDR : BinaryRR <"mdr", 0x2C, null_frag, FP64, FP64>;
174 def MXR : BinaryRR <"mxr", 0x26, null_frag, FP128, FP128>;
176 def MEE : BinaryRXE<"mee", 0xED37, null_frag, FP32, load, 4>;
177 def MD : BinaryRX <"md", 0x6C, null_frag, FP64, load, 8>;
179 // Extending multiplication (f32 x f32 -> f64).
180 def MDER : BinaryRR<"mder", 0x3C, null_frag, FP64, FP32>;
181 def MDE : BinaryRX<"mde", 0x7C, null_frag, FP64, load, 4>;
182 let isAsmParserOnly = 1 in {
183 def MER : BinaryRR<"mer", 0x3C, null_frag, FP64, FP32>;
184 def ME : BinaryRX<"me", 0x7C, null_frag, FP64, load, 4>;
187 // Extending multiplication (f64 x f64 -> f128).
188 def MXDR : BinaryRR<"mxdr", 0x27, null_frag, FP128, FP64>;
189 def MXD : BinaryRX<"mxd", 0x67, null_frag, FP128, load, 8>;
191 // Fused multiply-add.
192 def MAER : TernaryRRD<"maer", 0xB32E, null_frag, FP32, FP32>;
193 def MADR : TernaryRRD<"madr", 0xB33E, null_frag, FP64, FP64>;
194 def MAE : TernaryRXF<"mae", 0xED2E, null_frag, FP32, FP32, load, 4>;
195 def MAD : TernaryRXF<"mad", 0xED3E, null_frag, FP64, FP64, load, 8>;
197 // Fused multiply-subtract.
198 def MSER : TernaryRRD<"mser", 0xB32F, null_frag, FP32, FP32>;
199 def MSDR : TernaryRRD<"msdr", 0xB33F, null_frag, FP64, FP64>;
200 def MSE : TernaryRXF<"mse", 0xED2F, null_frag, FP32, FP32, load, 4>;
201 def MSD : TernaryRXF<"msd", 0xED3F, null_frag, FP64, FP64, load, 8>;
203 // Multiplication (unnormalized).
204 def MYR : BinaryRRD<"myr", 0xB33B, null_frag, FP128, FP64>;
205 def MYHR : BinaryRRD<"myhr", 0xB33D, null_frag, FP64, FP64>;
206 def MYLR : BinaryRRD<"mylr", 0xB339, null_frag, FP64, FP64>;
207 def MY : BinaryRXF<"my", 0xED3B, null_frag, FP128, FP64, load, 8>;
208 def MYH : BinaryRXF<"myh", 0xED3D, null_frag, FP64, FP64, load, 8>;
209 def MYL : BinaryRXF<"myl", 0xED39, null_frag, FP64, FP64, load, 8>;
211 // Fused multiply-add (unnormalized).
212 def MAYR : TernaryRRD<"mayr", 0xB33A, null_frag, FP128, FP64>;
213 def MAYHR : TernaryRRD<"mayhr", 0xB33C, null_frag, FP64, FP64>;
214 def MAYLR : TernaryRRD<"maylr", 0xB338, null_frag, FP64, FP64>;
215 def MAY : TernaryRXF<"may", 0xED3A, null_frag, FP128, FP64, load, 8>;
216 def MAYH : TernaryRXF<"mayh", 0xED3C, null_frag, FP64, FP64, load, 8>;
217 def MAYL : TernaryRXF<"mayl", 0xED38, null_frag, FP64, FP64, load, 8>;
220 def DER : BinaryRR <"der", 0x3D, null_frag, FP32, FP32>;
221 def DDR : BinaryRR <"ddr", 0x2D, null_frag, FP64, FP64>;
222 def DXR : BinaryRRE<"dxr", 0xB22D, null_frag, FP128, FP128>;
223 def DE : BinaryRX <"de", 0x7D, null_frag, FP32, load, 4>;
224 def DD : BinaryRX <"dd", 0x6D, null_frag, FP64, load, 8>;
227 //===----------------------------------------------------------------------===//
229 //===----------------------------------------------------------------------===//
232 def CER : CompareRR <"cer", 0x39, null_frag, FP32, FP32>;
233 def CDR : CompareRR <"cdr", 0x29, null_frag, FP64, FP64>;
234 def CXR : CompareRRE<"cxr", 0xB369, null_frag, FP128, FP128>;
236 def CE : CompareRX<"ce", 0x79, null_frag, FP32, load, 4>;
237 def CD : CompareRX<"cd", 0x69, null_frag, FP64, load, 8>;