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