1//===-- SystemZOperators.td - SystemZ-specific operators ------*- tblgen-*-===// 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//===----------------------------------------------------------------------===// 10// Type profiles 11//===----------------------------------------------------------------------===// 12def SDT_CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i64>, 13 SDTCisVT<1, i64>]>; 14def SDT_CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i64>, 15 SDTCisVT<1, i64>]>; 16def SDT_ZCall : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; 17def SDT_ZCmp : SDTypeProfile<1, 2, 18 [SDTCisVT<0, i32>, 19 SDTCisSameAs<1, 2>]>; 20def SDT_ZICmp : SDTypeProfile<1, 3, 21 [SDTCisVT<0, i32>, 22 SDTCisSameAs<1, 2>, 23 SDTCisVT<3, i32>]>; 24def SDT_ZBRCCMask : SDTypeProfile<0, 4, 25 [SDTCisVT<0, i32>, 26 SDTCisVT<1, i32>, 27 SDTCisVT<2, OtherVT>, 28 SDTCisVT<3, i32>]>; 29def SDT_ZSelectCCMask : SDTypeProfile<1, 5, 30 [SDTCisSameAs<0, 1>, 31 SDTCisSameAs<1, 2>, 32 SDTCisVT<3, i32>, 33 SDTCisVT<4, i32>, 34 SDTCisVT<5, i32>]>; 35def SDT_ZWrapPtr : SDTypeProfile<1, 1, 36 [SDTCisSameAs<0, 1>, 37 SDTCisPtrTy<0>]>; 38def SDT_ZWrapOffset : SDTypeProfile<1, 2, 39 [SDTCisSameAs<0, 1>, 40 SDTCisSameAs<0, 2>, 41 SDTCisPtrTy<0>]>; 42def SDT_ZAdjDynAlloc : SDTypeProfile<1, 0, [SDTCisVT<0, i64>]>; 43def SDT_ZProbedAlloca : SDTypeProfile<1, 2, 44 [SDTCisSameAs<0, 1>, 45 SDTCisSameAs<0, 2>, 46 SDTCisPtrTy<0>]>; 47def SDT_ZGR128Binary : SDTypeProfile<1, 2, 48 [SDTCisVT<0, untyped>, 49 SDTCisInt<1>, 50 SDTCisInt<2>]>; 51def SDT_ZBinaryWithFlags : SDTypeProfile<2, 2, 52 [SDTCisInt<0>, 53 SDTCisVT<1, i32>, 54 SDTCisSameAs<0, 2>, 55 SDTCisSameAs<0, 3>]>; 56def SDT_ZBinaryWithCarry : SDTypeProfile<2, 3, 57 [SDTCisInt<0>, 58 SDTCisVT<1, i32>, 59 SDTCisSameAs<0, 2>, 60 SDTCisSameAs<0, 3>, 61 SDTCisVT<1, i32>]>; 62def SDT_ZAtomicLoadBinaryW : SDTypeProfile<1, 5, 63 [SDTCisVT<0, i32>, 64 SDTCisPtrTy<1>, 65 SDTCisVT<2, i32>, 66 SDTCisVT<3, i32>, 67 SDTCisVT<4, i32>, 68 SDTCisVT<5, i32>]>; 69def SDT_ZAtomicCmpSwapW : SDTypeProfile<2, 6, 70 [SDTCisVT<0, i32>, 71 SDTCisVT<1, i32>, 72 SDTCisPtrTy<2>, 73 SDTCisVT<3, i32>, 74 SDTCisVT<4, i32>, 75 SDTCisVT<5, i32>, 76 SDTCisVT<6, i32>, 77 SDTCisVT<7, i32>]>; 78def SDT_ZAtomicCmpSwap : SDTypeProfile<2, 3, 79 [SDTCisInt<0>, 80 SDTCisVT<1, i32>, 81 SDTCisPtrTy<2>, 82 SDTCisSameAs<0, 3>, 83 SDTCisSameAs<0, 4>]>; 84def SDT_ZAtomicLoad128 : SDTypeProfile<1, 1, 85 [SDTCisVT<0, untyped>, 86 SDTCisPtrTy<1>]>; 87def SDT_ZAtomicStore128 : SDTypeProfile<0, 2, 88 [SDTCisVT<0, untyped>, 89 SDTCisPtrTy<1>]>; 90def SDT_ZAtomicCmpSwap128 : SDTypeProfile<2, 3, 91 [SDTCisVT<0, untyped>, 92 SDTCisVT<1, i32>, 93 SDTCisPtrTy<2>, 94 SDTCisVT<3, untyped>, 95 SDTCisVT<4, untyped>]>; 96def SDT_ZMemMemLength : SDTypeProfile<0, 3, 97 [SDTCisPtrTy<0>, 98 SDTCisPtrTy<1>, 99 SDTCisVT<2, i64>]>; 100def SDT_ZMemMemLengthCC : SDTypeProfile<1, 3, 101 [SDTCisVT<0, i32>, 102 SDTCisPtrTy<1>, 103 SDTCisPtrTy<2>, 104 SDTCisVT<3, i64>]>; 105def SDT_ZMemsetMVC : SDTypeProfile<0, 3, 106 [SDTCisPtrTy<0>, 107 SDTCisVT<1, i64>, 108 SDTCisVT<2, i32>]>; 109def SDT_ZString : SDTypeProfile<1, 3, 110 [SDTCisPtrTy<0>, 111 SDTCisPtrTy<1>, 112 SDTCisPtrTy<2>, 113 SDTCisVT<3, i32>]>; 114def SDT_ZStringCC : SDTypeProfile<2, 3, 115 [SDTCisPtrTy<0>, 116 SDTCisVT<1, i32>, 117 SDTCisPtrTy<2>, 118 SDTCisPtrTy<3>, 119 SDTCisVT<4, i32>]>; 120def SDT_ZIPM : SDTypeProfile<1, 1, 121 [SDTCisVT<0, i32>, 122 SDTCisVT<1, i32>]>; 123def SDT_ZPrefetch : SDTypeProfile<0, 2, 124 [SDTCisVT<0, i32>, 125 SDTCisPtrTy<1>]>; 126def SDT_ZTBegin : SDTypeProfile<1, 2, 127 [SDTCisVT<0, i32>, 128 SDTCisPtrTy<1>, 129 SDTCisVT<2, i32>]>; 130def SDT_ZTEnd : SDTypeProfile<1, 0, 131 [SDTCisVT<0, i32>]>; 132def SDT_ZInsertVectorElt : SDTypeProfile<1, 3, 133 [SDTCisVec<0>, 134 SDTCisSameAs<0, 1>, 135 SDTCisVT<3, i32>]>; 136def SDT_ZExtractVectorElt : SDTypeProfile<1, 2, 137 [SDTCisVec<1>, 138 SDTCisVT<2, i32>]>; 139def SDT_ZReplicate : SDTypeProfile<1, 1, 140 [SDTCisVec<0>]>; 141def SDT_ZVecUnaryConv : SDTypeProfile<1, 1, 142 [SDTCisVec<0>, 143 SDTCisVec<1>]>; 144def SDT_ZVecUnary : SDTypeProfile<1, 1, 145 [SDTCisVec<0>, 146 SDTCisSameAs<0, 1>]>; 147def SDT_ZVecUnaryCC : SDTypeProfile<2, 1, 148 [SDTCisVec<0>, 149 SDTCisVT<1, i32>, 150 SDTCisSameAs<0, 2>]>; 151def SDT_ZVecBinary : SDTypeProfile<1, 2, 152 [SDTCisVec<0>, 153 SDTCisSameAs<0, 1>, 154 SDTCisSameAs<0, 2>]>; 155def SDT_ZVecBinaryCC : SDTypeProfile<2, 2, 156 [SDTCisVec<0>, 157 SDTCisVT<1, i32>, 158 SDTCisSameAs<0, 2>, 159 SDTCisSameAs<0, 2>]>; 160def SDT_ZVecBinaryInt : SDTypeProfile<1, 2, 161 [SDTCisVec<0>, 162 SDTCisSameAs<0, 1>, 163 SDTCisVT<2, i32>]>; 164def SDT_ZVecBinaryConv : SDTypeProfile<1, 2, 165 [SDTCisVec<0>, 166 SDTCisVec<1>, 167 SDTCisSameAs<1, 2>]>; 168def SDT_ZVecBinaryConvCC : SDTypeProfile<2, 2, 169 [SDTCisVec<0>, 170 SDTCisVT<1, i32>, 171 SDTCisVec<2>, 172 SDTCisSameAs<2, 3>]>; 173def SDT_ZVecBinaryConvIntCC : SDTypeProfile<2, 2, 174 [SDTCisVec<0>, 175 SDTCisVT<1, i32>, 176 SDTCisVec<2>, 177 SDTCisVT<3, i32>]>; 178def SDT_ZRotateMask : SDTypeProfile<1, 2, 179 [SDTCisVec<0>, 180 SDTCisVT<1, i32>, 181 SDTCisVT<2, i32>]>; 182def SDT_ZJoinDwords : SDTypeProfile<1, 2, 183 [SDTCisVT<0, v2i64>, 184 SDTCisVT<1, i64>, 185 SDTCisVT<2, i64>]>; 186def SDT_ZVecTernary : SDTypeProfile<1, 3, 187 [SDTCisVec<0>, 188 SDTCisSameAs<0, 1>, 189 SDTCisSameAs<0, 2>, 190 SDTCisSameAs<0, 3>]>; 191def SDT_ZVecTernaryConvCC : SDTypeProfile<2, 3, 192 [SDTCisVec<0>, 193 SDTCisVT<1, i32>, 194 SDTCisVec<2>, 195 SDTCisSameAs<2, 3>, 196 SDTCisSameAs<0, 4>]>; 197def SDT_ZVecTernaryInt : SDTypeProfile<1, 3, 198 [SDTCisVec<0>, 199 SDTCisSameAs<0, 1>, 200 SDTCisSameAs<0, 2>, 201 SDTCisVT<3, i32>]>; 202def SDT_ZVecTernaryIntCC : SDTypeProfile<2, 3, 203 [SDTCisVec<0>, 204 SDTCisVT<1, i32>, 205 SDTCisSameAs<0, 2>, 206 SDTCisSameAs<0, 3>, 207 SDTCisVT<4, i32>]>; 208def SDT_ZVecQuaternaryInt : SDTypeProfile<1, 4, 209 [SDTCisVec<0>, 210 SDTCisSameAs<0, 1>, 211 SDTCisSameAs<0, 2>, 212 SDTCisSameAs<0, 3>, 213 SDTCisVT<4, i32>]>; 214def SDT_ZVecQuaternaryIntCC : SDTypeProfile<2, 4, 215 [SDTCisVec<0>, 216 SDTCisVT<1, i32>, 217 SDTCisSameAs<0, 2>, 218 SDTCisSameAs<0, 3>, 219 SDTCisSameAs<0, 4>, 220 SDTCisVT<5, i32>]>; 221def SDT_ZTest : SDTypeProfile<1, 2, 222 [SDTCisVT<0, i32>, 223 SDTCisVT<2, i64>]>; 224 225//===----------------------------------------------------------------------===// 226// Node definitions 227//===----------------------------------------------------------------------===// 228 229// These are target-independent nodes, but have target-specific formats. 230def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_CallSeqStart, 231 [SDNPHasChain, SDNPSideEffect, SDNPOutGlue]>; 232def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_CallSeqEnd, 233 [SDNPHasChain, SDNPSideEffect, SDNPOptInGlue, 234 SDNPOutGlue]>; 235def global_offset_table : SDNode<"ISD::GLOBAL_OFFSET_TABLE", SDTPtrLeaf>; 236 237// Nodes for SystemZISD::*. See SystemZISelLowering.h for more details. 238def z_retflag : SDNode<"SystemZISD::RET_FLAG", SDTNone, 239 [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; 240def z_call : SDNode<"SystemZISD::CALL", SDT_ZCall, 241 [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue, 242 SDNPVariadic]>; 243def z_sibcall : SDNode<"SystemZISD::SIBCALL", SDT_ZCall, 244 [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue, 245 SDNPVariadic]>; 246def z_tls_gdcall : SDNode<"SystemZISD::TLS_GDCALL", SDT_ZCall, 247 [SDNPHasChain, SDNPInGlue, SDNPOutGlue, 248 SDNPVariadic]>; 249def z_tls_ldcall : SDNode<"SystemZISD::TLS_LDCALL", SDT_ZCall, 250 [SDNPHasChain, SDNPInGlue, SDNPOutGlue, 251 SDNPVariadic]>; 252def z_pcrel_wrapper : SDNode<"SystemZISD::PCREL_WRAPPER", SDT_ZWrapPtr, []>; 253def z_pcrel_offset : SDNode<"SystemZISD::PCREL_OFFSET", 254 SDT_ZWrapOffset, []>; 255def z_icmp : SDNode<"SystemZISD::ICMP", SDT_ZICmp>; 256def z_fcmp : SDNode<"SystemZISD::FCMP", SDT_ZCmp>; 257def z_strict_fcmp : SDNode<"SystemZISD::STRICT_FCMP", SDT_ZCmp, 258 [SDNPHasChain]>; 259def z_strict_fcmps : SDNode<"SystemZISD::STRICT_FCMPS", SDT_ZCmp, 260 [SDNPHasChain]>; 261def z_tm : SDNode<"SystemZISD::TM", SDT_ZICmp>; 262def z_br_ccmask_1 : SDNode<"SystemZISD::BR_CCMASK", SDT_ZBRCCMask, 263 [SDNPHasChain]>; 264def z_select_ccmask_1 : SDNode<"SystemZISD::SELECT_CCMASK", 265 SDT_ZSelectCCMask>; 266def z_ipm_1 : SDNode<"SystemZISD::IPM", SDT_ZIPM>; 267def z_adjdynalloc : SDNode<"SystemZISD::ADJDYNALLOC", SDT_ZAdjDynAlloc>; 268def z_probed_alloca : SDNode<"SystemZISD::PROBED_ALLOCA", SDT_ZProbedAlloca, 269 [SDNPHasChain]>; 270def z_popcnt : SDNode<"SystemZISD::POPCNT", SDTIntUnaryOp>; 271def z_smul_lohi : SDNode<"SystemZISD::SMUL_LOHI", SDT_ZGR128Binary>; 272def z_umul_lohi : SDNode<"SystemZISD::UMUL_LOHI", SDT_ZGR128Binary>; 273def z_sdivrem : SDNode<"SystemZISD::SDIVREM", SDT_ZGR128Binary>; 274def z_udivrem : SDNode<"SystemZISD::UDIVREM", SDT_ZGR128Binary>; 275def z_saddo : SDNode<"SystemZISD::SADDO", SDT_ZBinaryWithFlags>; 276def z_ssubo : SDNode<"SystemZISD::SSUBO", SDT_ZBinaryWithFlags>; 277def z_uaddo : SDNode<"SystemZISD::UADDO", SDT_ZBinaryWithFlags>; 278def z_usubo : SDNode<"SystemZISD::USUBO", SDT_ZBinaryWithFlags>; 279def z_addcarry_1 : SDNode<"SystemZISD::ADDCARRY", SDT_ZBinaryWithCarry>; 280def z_subcarry_1 : SDNode<"SystemZISD::SUBCARRY", SDT_ZBinaryWithCarry>; 281 282def z_loadbswap : SDNode<"SystemZISD::LRV", SDTLoad, 283 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 284def z_storebswap : SDNode<"SystemZISD::STRV", SDTStore, 285 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 286def z_loadeswap : SDNode<"SystemZISD::VLER", SDTLoad, 287 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 288def z_storeeswap : SDNode<"SystemZISD::VSTER", SDTStore, 289 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 290 291def z_tdc : SDNode<"SystemZISD::TDC", SDT_ZTest>; 292 293// Defined because the index is an i32 rather than a pointer. 294def z_vector_insert : SDNode<"ISD::INSERT_VECTOR_ELT", 295 SDT_ZInsertVectorElt>; 296def z_vector_extract : SDNode<"ISD::EXTRACT_VECTOR_ELT", 297 SDT_ZExtractVectorElt>; 298def z_byte_mask : SDNode<"SystemZISD::BYTE_MASK", SDT_ZReplicate>; 299def z_rotate_mask : SDNode<"SystemZISD::ROTATE_MASK", SDT_ZRotateMask>; 300def z_replicate : SDNode<"SystemZISD::REPLICATE", SDT_ZReplicate>; 301def z_join_dwords : SDNode<"SystemZISD::JOIN_DWORDS", SDT_ZJoinDwords>; 302def z_splat : SDNode<"SystemZISD::SPLAT", SDT_ZVecBinaryInt>; 303def z_merge_high : SDNode<"SystemZISD::MERGE_HIGH", SDT_ZVecBinary>; 304def z_merge_low : SDNode<"SystemZISD::MERGE_LOW", SDT_ZVecBinary>; 305def z_shl_double : SDNode<"SystemZISD::SHL_DOUBLE", SDT_ZVecTernaryInt>; 306def z_permute_dwords : SDNode<"SystemZISD::PERMUTE_DWORDS", 307 SDT_ZVecTernaryInt>; 308def z_permute : SDNode<"SystemZISD::PERMUTE", SDT_ZVecTernary>; 309def z_pack : SDNode<"SystemZISD::PACK", SDT_ZVecBinaryConv>; 310def z_packs_cc : SDNode<"SystemZISD::PACKS_CC", SDT_ZVecBinaryConvCC>; 311def z_packls_cc : SDNode<"SystemZISD::PACKLS_CC", SDT_ZVecBinaryConvCC>; 312def z_unpack_high : SDNode<"SystemZISD::UNPACK_HIGH", SDT_ZVecUnaryConv>; 313def z_unpackl_high : SDNode<"SystemZISD::UNPACKL_HIGH", SDT_ZVecUnaryConv>; 314def z_unpack_low : SDNode<"SystemZISD::UNPACK_LOW", SDT_ZVecUnaryConv>; 315def z_unpackl_low : SDNode<"SystemZISD::UNPACKL_LOW", SDT_ZVecUnaryConv>; 316def z_vshl_by_scalar : SDNode<"SystemZISD::VSHL_BY_SCALAR", 317 SDT_ZVecBinaryInt>; 318def z_vsrl_by_scalar : SDNode<"SystemZISD::VSRL_BY_SCALAR", 319 SDT_ZVecBinaryInt>; 320def z_vsra_by_scalar : SDNode<"SystemZISD::VSRA_BY_SCALAR", 321 SDT_ZVecBinaryInt>; 322def z_vsum : SDNode<"SystemZISD::VSUM", SDT_ZVecBinaryConv>; 323def z_vicmpe : SDNode<"SystemZISD::VICMPE", SDT_ZVecBinary>; 324def z_vicmph : SDNode<"SystemZISD::VICMPH", SDT_ZVecBinary>; 325def z_vicmphl : SDNode<"SystemZISD::VICMPHL", SDT_ZVecBinary>; 326def z_vicmpes : SDNode<"SystemZISD::VICMPES", SDT_ZVecBinaryCC>; 327def z_vicmphs : SDNode<"SystemZISD::VICMPHS", SDT_ZVecBinaryCC>; 328def z_vicmphls : SDNode<"SystemZISD::VICMPHLS", SDT_ZVecBinaryCC>; 329def z_vfcmpe : SDNode<"SystemZISD::VFCMPE", SDT_ZVecBinaryConv>; 330def z_strict_vfcmpe : SDNode<"SystemZISD::STRICT_VFCMPE", 331 SDT_ZVecBinaryConv, [SDNPHasChain]>; 332def z_strict_vfcmpes : SDNode<"SystemZISD::STRICT_VFCMPES", 333 SDT_ZVecBinaryConv, [SDNPHasChain]>; 334def z_vfcmph : SDNode<"SystemZISD::VFCMPH", SDT_ZVecBinaryConv>; 335def z_strict_vfcmph : SDNode<"SystemZISD::STRICT_VFCMPH", 336 SDT_ZVecBinaryConv, [SDNPHasChain]>; 337def z_strict_vfcmphs : SDNode<"SystemZISD::STRICT_VFCMPHS", 338 SDT_ZVecBinaryConv, [SDNPHasChain]>; 339def z_vfcmphe : SDNode<"SystemZISD::VFCMPHE", SDT_ZVecBinaryConv>; 340def z_strict_vfcmphe : SDNode<"SystemZISD::STRICT_VFCMPHE", 341 SDT_ZVecBinaryConv, [SDNPHasChain]>; 342def z_strict_vfcmphes : SDNode<"SystemZISD::STRICT_VFCMPHES", 343 SDT_ZVecBinaryConv, [SDNPHasChain]>; 344def z_vfcmpes : SDNode<"SystemZISD::VFCMPES", SDT_ZVecBinaryConvCC>; 345def z_vfcmphs : SDNode<"SystemZISD::VFCMPHS", SDT_ZVecBinaryConvCC>; 346def z_vfcmphes : SDNode<"SystemZISD::VFCMPHES", SDT_ZVecBinaryConvCC>; 347def z_vextend : SDNode<"SystemZISD::VEXTEND", SDT_ZVecUnaryConv>; 348def z_strict_vextend : SDNode<"SystemZISD::STRICT_VEXTEND", 349 SDT_ZVecUnaryConv, [SDNPHasChain]>; 350def z_vround : SDNode<"SystemZISD::VROUND", SDT_ZVecUnaryConv>; 351def z_strict_vround : SDNode<"SystemZISD::STRICT_VROUND", 352 SDT_ZVecUnaryConv, [SDNPHasChain]>; 353def z_vtm : SDNode<"SystemZISD::VTM", SDT_ZCmp>; 354def z_vfae_cc : SDNode<"SystemZISD::VFAE_CC", SDT_ZVecTernaryIntCC>; 355def z_vfaez_cc : SDNode<"SystemZISD::VFAEZ_CC", SDT_ZVecTernaryIntCC>; 356def z_vfee_cc : SDNode<"SystemZISD::VFEE_CC", SDT_ZVecBinaryCC>; 357def z_vfeez_cc : SDNode<"SystemZISD::VFEEZ_CC", SDT_ZVecBinaryCC>; 358def z_vfene_cc : SDNode<"SystemZISD::VFENE_CC", SDT_ZVecBinaryCC>; 359def z_vfenez_cc : SDNode<"SystemZISD::VFENEZ_CC", SDT_ZVecBinaryCC>; 360def z_vistr_cc : SDNode<"SystemZISD::VISTR_CC", SDT_ZVecUnaryCC>; 361def z_vstrc_cc : SDNode<"SystemZISD::VSTRC_CC", 362 SDT_ZVecQuaternaryIntCC>; 363def z_vstrcz_cc : SDNode<"SystemZISD::VSTRCZ_CC", 364 SDT_ZVecQuaternaryIntCC>; 365def z_vstrs_cc : SDNode<"SystemZISD::VSTRS_CC", 366 SDT_ZVecTernaryConvCC>; 367def z_vstrsz_cc : SDNode<"SystemZISD::VSTRSZ_CC", 368 SDT_ZVecTernaryConvCC>; 369def z_vftci : SDNode<"SystemZISD::VFTCI", SDT_ZVecBinaryConvIntCC>; 370 371class AtomicWOp<string name, SDTypeProfile profile = SDT_ZAtomicLoadBinaryW> 372 : SDNode<"SystemZISD::"#name, profile, 373 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 374 375def z_atomic_swapw : AtomicWOp<"ATOMIC_SWAPW">; 376def z_atomic_loadw_add : AtomicWOp<"ATOMIC_LOADW_ADD">; 377def z_atomic_loadw_sub : AtomicWOp<"ATOMIC_LOADW_SUB">; 378def z_atomic_loadw_and : AtomicWOp<"ATOMIC_LOADW_AND">; 379def z_atomic_loadw_or : AtomicWOp<"ATOMIC_LOADW_OR">; 380def z_atomic_loadw_xor : AtomicWOp<"ATOMIC_LOADW_XOR">; 381def z_atomic_loadw_nand : AtomicWOp<"ATOMIC_LOADW_NAND">; 382def z_atomic_loadw_min : AtomicWOp<"ATOMIC_LOADW_MIN">; 383def z_atomic_loadw_max : AtomicWOp<"ATOMIC_LOADW_MAX">; 384def z_atomic_loadw_umin : AtomicWOp<"ATOMIC_LOADW_UMIN">; 385def z_atomic_loadw_umax : AtomicWOp<"ATOMIC_LOADW_UMAX">; 386 387def z_atomic_cmp_swap : SDNode<"SystemZISD::ATOMIC_CMP_SWAP", 388 SDT_ZAtomicCmpSwap, 389 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, 390 SDNPMemOperand]>; 391def z_atomic_cmp_swapw : SDNode<"SystemZISD::ATOMIC_CMP_SWAPW", 392 SDT_ZAtomicCmpSwapW, 393 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, 394 SDNPMemOperand]>; 395 396def z_atomic_load_128 : SDNode<"SystemZISD::ATOMIC_LOAD_128", 397 SDT_ZAtomicLoad128, 398 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 399def z_atomic_store_128 : SDNode<"SystemZISD::ATOMIC_STORE_128", 400 SDT_ZAtomicStore128, 401 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 402def z_atomic_cmp_swap_128 : SDNode<"SystemZISD::ATOMIC_CMP_SWAP_128", 403 SDT_ZAtomicCmpSwap128, 404 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, 405 SDNPMemOperand]>; 406 407def z_mvc : SDNode<"SystemZISD::MVC", SDT_ZMemMemLength, 408 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 409def z_nc : SDNode<"SystemZISD::NC", SDT_ZMemMemLength, 410 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 411def z_oc : SDNode<"SystemZISD::OC", SDT_ZMemMemLength, 412 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 413def z_xc : SDNode<"SystemZISD::XC", SDT_ZMemMemLength, 414 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 415def z_clc : SDNode<"SystemZISD::CLC", SDT_ZMemMemLengthCC, 416 [SDNPHasChain, SDNPMayLoad]>; 417def z_memset_mvc : SDNode<"SystemZISD::MEMSET_MVC", SDT_ZMemsetMVC, 418 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 419def z_strcmp : SDNode<"SystemZISD::STRCMP", SDT_ZStringCC, 420 [SDNPHasChain, SDNPMayLoad]>; 421def z_stpcpy : SDNode<"SystemZISD::STPCPY", SDT_ZString, 422 [SDNPHasChain, SDNPMayStore, SDNPMayLoad]>; 423def z_search_string : SDNode<"SystemZISD::SEARCH_STRING", SDT_ZStringCC, 424 [SDNPHasChain, SDNPMayLoad]>; 425def z_prefetch : SDNode<"SystemZISD::PREFETCH", SDT_ZPrefetch, 426 [SDNPHasChain, SDNPMayLoad, SDNPMayStore, 427 SDNPMemOperand]>; 428 429def z_tbegin : SDNode<"SystemZISD::TBEGIN", SDT_ZTBegin, 430 [SDNPHasChain, SDNPMayStore, SDNPSideEffect]>; 431def z_tbegin_nofloat : SDNode<"SystemZISD::TBEGIN_NOFLOAT", SDT_ZTBegin, 432 [SDNPHasChain, SDNPMayStore, SDNPSideEffect]>; 433def z_tend : SDNode<"SystemZISD::TEND", SDT_ZTEnd, 434 [SDNPHasChain, SDNPSideEffect]>; 435 436def z_vshl : SDNode<"ISD::SHL", SDT_ZVecBinary>; 437def z_vsra : SDNode<"ISD::SRA", SDT_ZVecBinary>; 438def z_vsrl : SDNode<"ISD::SRL", SDT_ZVecBinary>; 439 440//===----------------------------------------------------------------------===// 441// Pattern fragments 442//===----------------------------------------------------------------------===// 443 444def z_loadbswap16 : PatFrag<(ops node:$addr), (z_loadbswap node:$addr), [{ 445 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i16; 446}]>; 447def z_loadbswap32 : PatFrag<(ops node:$addr), (z_loadbswap node:$addr), [{ 448 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i32; 449}]>; 450def z_loadbswap64 : PatFrag<(ops node:$addr), (z_loadbswap node:$addr), [{ 451 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i64; 452}]>; 453 454def z_storebswap16 : PatFrag<(ops node:$src, node:$addr), 455 (z_storebswap node:$src, node:$addr), [{ 456 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i16; 457}]>; 458def z_storebswap32 : PatFrag<(ops node:$src, node:$addr), 459 (z_storebswap node:$src, node:$addr), [{ 460 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i32; 461}]>; 462def z_storebswap64 : PatFrag<(ops node:$src, node:$addr), 463 (z_storebswap node:$src, node:$addr), [{ 464 return cast<MemIntrinsicSDNode>(N)->getMemoryVT() == MVT::i64; 465}]>; 466 467// Fragments including CC as an implicit source. 468def z_br_ccmask 469 : PatFrag<(ops node:$valid, node:$mask, node:$bb), 470 (z_br_ccmask_1 node:$valid, node:$mask, node:$bb, CC)>; 471def z_select_ccmask 472 : PatFrag<(ops node:$true, node:$false, node:$valid, node:$mask), 473 (z_select_ccmask_1 node:$true, node:$false, 474 node:$valid, node:$mask, CC)>; 475def z_ipm : PatFrag<(ops), (z_ipm_1 CC)>; 476def z_addcarry : PatFrag<(ops node:$lhs, node:$rhs), 477 (z_addcarry_1 node:$lhs, node:$rhs, CC)>; 478def z_subcarry : PatFrag<(ops node:$lhs, node:$rhs), 479 (z_subcarry_1 node:$lhs, node:$rhs, CC)>; 480 481// Signed and unsigned comparisons. 482def z_scmp : PatFrag<(ops node:$a, node:$b), (z_icmp node:$a, node:$b, timm), [{ 483 unsigned Type = cast<ConstantSDNode>(N->getOperand(2))->getZExtValue(); 484 return Type != SystemZICMP::UnsignedOnly; 485}]>; 486def z_ucmp : PatFrag<(ops node:$a, node:$b), (z_icmp node:$a, node:$b, timm), [{ 487 unsigned Type = cast<ConstantSDNode>(N->getOperand(2))->getZExtValue(); 488 return Type != SystemZICMP::SignedOnly; 489}]>; 490 491// Register- and memory-based TEST UNDER MASK. 492def z_tm_reg : PatFrag<(ops node:$a, node:$b), (z_tm node:$a, node:$b, timm)>; 493def z_tm_mem : PatFrag<(ops node:$a, node:$b), (z_tm node:$a, node:$b, 0)>; 494 495// Register sign-extend operations. Sub-32-bit values are represented as i32s. 496def sext8 : PatFrag<(ops node:$src), (sext_inreg node:$src, i8)>; 497def sext16 : PatFrag<(ops node:$src), (sext_inreg node:$src, i16)>; 498def sext32 : PatFrag<(ops node:$src), (sext (i32 node:$src))>; 499 500// Match extensions of an i32 to an i64, followed by an in-register sign 501// extension from a sub-i32 value. 502def sext8dbl : PatFrag<(ops node:$src), (sext8 (anyext node:$src))>; 503def sext16dbl : PatFrag<(ops node:$src), (sext16 (anyext node:$src))>; 504 505// Register zero-extend operations. Sub-32-bit values are represented as i32s. 506def zext8 : PatFrag<(ops node:$src), (and node:$src, 0xff)>; 507def zext16 : PatFrag<(ops node:$src), (and node:$src, 0xffff)>; 508def zext32 : PatFrag<(ops node:$src), (zext (i32 node:$src))>; 509 510// Extending loads in which the extension type can be signed. 511def asextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{ 512 unsigned Type = cast<LoadSDNode>(N)->getExtensionType(); 513 return Type == ISD::EXTLOAD || Type == ISD::SEXTLOAD; 514}]>; 515def asextloadi8 : PatFrag<(ops node:$ptr), (asextload node:$ptr), [{ 516 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8; 517}]>; 518def asextloadi16 : PatFrag<(ops node:$ptr), (asextload node:$ptr), [{ 519 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16; 520}]>; 521def asextloadi32 : PatFrag<(ops node:$ptr), (asextload node:$ptr), [{ 522 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32; 523}]>; 524 525// Extending loads in which the extension type can be unsigned. 526def azextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{ 527 unsigned Type = cast<LoadSDNode>(N)->getExtensionType(); 528 return Type == ISD::EXTLOAD || Type == ISD::ZEXTLOAD; 529}]>; 530def azextloadi8 : PatFrag<(ops node:$ptr), (azextload node:$ptr), [{ 531 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8; 532}]>; 533def azextloadi16 : PatFrag<(ops node:$ptr), (azextload node:$ptr), [{ 534 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16; 535}]>; 536def azextloadi32 : PatFrag<(ops node:$ptr), (azextload node:$ptr), [{ 537 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32; 538}]>; 539 540// Extending loads in which the extension type doesn't matter. 541def anyextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr), [{ 542 return cast<LoadSDNode>(N)->getExtensionType() != ISD::NON_EXTLOAD; 543}]>; 544def anyextloadi8 : PatFrag<(ops node:$ptr), (anyextload node:$ptr), [{ 545 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8; 546}]>; 547def anyextloadi16 : PatFrag<(ops node:$ptr), (anyextload node:$ptr), [{ 548 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16; 549}]>; 550def anyextloadi32 : PatFrag<(ops node:$ptr), (anyextload node:$ptr), [{ 551 return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i32; 552}]>; 553 554// Aligned loads. 555class AlignedLoad<SDPatternOperator load> 556 : PatFrag<(ops node:$addr), (load node:$addr), 557 [{ return storeLoadIsAligned(N); }]>; 558def aligned_load : AlignedLoad<load>; 559def aligned_asextloadi16 : AlignedLoad<asextloadi16>; 560def aligned_asextloadi32 : AlignedLoad<asextloadi32>; 561def aligned_azextloadi16 : AlignedLoad<azextloadi16>; 562def aligned_azextloadi32 : AlignedLoad<azextloadi32>; 563 564// Aligned stores. 565class AlignedStore<SDPatternOperator store> 566 : PatFrag<(ops node:$src, node:$addr), (store node:$src, node:$addr), 567 [{ return storeLoadIsAligned(N); }]>; 568def aligned_store : AlignedStore<store>; 569def aligned_truncstorei16 : AlignedStore<truncstorei16>; 570def aligned_truncstorei32 : AlignedStore<truncstorei32>; 571 572// Non-volatile loads. Used for instructions that might access the storage 573// location multiple times. 574class NonvolatileLoad<SDPatternOperator load> 575 : PatFrag<(ops node:$addr), (load node:$addr), [{ 576 auto *Load = cast<LoadSDNode>(N); 577 return !Load->isVolatile(); 578}]>; 579def nonvolatile_anyextloadi8 : NonvolatileLoad<anyextloadi8>; 580def nonvolatile_anyextloadi16 : NonvolatileLoad<anyextloadi16>; 581def nonvolatile_anyextloadi32 : NonvolatileLoad<anyextloadi32>; 582 583// Non-volatile stores. 584class NonvolatileStore<SDPatternOperator store> 585 : PatFrag<(ops node:$src, node:$addr), (store node:$src, node:$addr), [{ 586 auto *Store = cast<StoreSDNode>(N); 587 return !Store->isVolatile(); 588}]>; 589def nonvolatile_truncstorei8 : NonvolatileStore<truncstorei8>; 590def nonvolatile_truncstorei16 : NonvolatileStore<truncstorei16>; 591def nonvolatile_truncstorei32 : NonvolatileStore<truncstorei32>; 592 593// A store of a load that can be implemented using MVC. 594def mvc_store : PatFrag<(ops node:$value, node:$addr), 595 (unindexedstore node:$value, node:$addr), 596 [{ return storeLoadCanUseMVC(N); }]>; 597 598// Binary read-modify-write operations on memory in which the other 599// operand is also memory and for which block operations like NC can 600// be used. There are two patterns for each operator, depending on 601// which operand contains the "other" load. 602multiclass block_op<SDPatternOperator operator> { 603 def "1" : PatFrag<(ops node:$value, node:$addr), 604 (unindexedstore (operator node:$value, 605 (unindexedload node:$addr)), 606 node:$addr), 607 [{ return storeLoadCanUseBlockBinary(N, 0); }]>; 608 def "2" : PatFrag<(ops node:$value, node:$addr), 609 (unindexedstore (operator (unindexedload node:$addr), 610 node:$value), 611 node:$addr), 612 [{ return storeLoadCanUseBlockBinary(N, 1); }]>; 613} 614defm block_and : block_op<and>; 615defm block_or : block_op<or>; 616defm block_xor : block_op<xor>; 617 618// Insertions. 619def inserti8 : PatFrag<(ops node:$src1, node:$src2), 620 (or (and node:$src1, -256), node:$src2)>; 621def insertll : PatFrag<(ops node:$src1, node:$src2), 622 (or (and node:$src1, 0xffffffffffff0000), node:$src2)>; 623def insertlh : PatFrag<(ops node:$src1, node:$src2), 624 (or (and node:$src1, 0xffffffff0000ffff), node:$src2)>; 625def inserthl : PatFrag<(ops node:$src1, node:$src2), 626 (or (and node:$src1, 0xffff0000ffffffff), node:$src2)>; 627def inserthh : PatFrag<(ops node:$src1, node:$src2), 628 (or (and node:$src1, 0x0000ffffffffffff), node:$src2)>; 629def insertlf : PatFrag<(ops node:$src1, node:$src2), 630 (or (and node:$src1, 0xffffffff00000000), node:$src2)>; 631def inserthf : PatFrag<(ops node:$src1, node:$src2), 632 (or (and node:$src1, 0x00000000ffffffff), node:$src2)>; 633 634// ORs that can be treated as insertions. 635def or_as_inserti8 : PatFrag<(ops node:$src1, node:$src2), 636 (or node:$src1, node:$src2), [{ 637 unsigned BitWidth = N->getValueType(0).getScalarSizeInBits(); 638 return CurDAG->MaskedValueIsZero(N->getOperand(0), 639 APInt::getLowBitsSet(BitWidth, 8)); 640}]>; 641 642// ORs that can be treated as reversed insertions. 643def or_as_revinserti8 : PatFrag<(ops node:$src1, node:$src2), 644 (or node:$src1, node:$src2), [{ 645 unsigned BitWidth = N->getValueType(0).getScalarSizeInBits(); 646 return CurDAG->MaskedValueIsZero(N->getOperand(1), 647 APInt::getLowBitsSet(BitWidth, 8)); 648}]>; 649 650// Negative integer absolute. 651def z_inegabs : PatFrag<(ops node:$src), (ineg (abs node:$src))>; 652 653// Integer multiply-and-add 654def z_muladd : PatFrag<(ops node:$src1, node:$src2, node:$src3), 655 (add (mul node:$src1, node:$src2), node:$src3)>; 656 657// Alternatives to match operations with or without an overflow CC result. 658def z_sadd : PatFrags<(ops node:$src1, node:$src2), 659 [(z_saddo node:$src1, node:$src2), 660 (add node:$src1, node:$src2)]>; 661def z_uadd : PatFrags<(ops node:$src1, node:$src2), 662 [(z_uaddo node:$src1, node:$src2), 663 (add node:$src1, node:$src2)]>; 664def z_ssub : PatFrags<(ops node:$src1, node:$src2), 665 [(z_ssubo node:$src1, node:$src2), 666 (sub node:$src1, node:$src2)]>; 667def z_usub : PatFrags<(ops node:$src1, node:$src2), 668 [(z_usubo node:$src1, node:$src2), 669 (sub node:$src1, node:$src2)]>; 670 671// Combined logical operations. 672def andc : PatFrag<(ops node:$src1, node:$src2), 673 (and node:$src1, (not node:$src2))>; 674def orc : PatFrag<(ops node:$src1, node:$src2), 675 (or node:$src1, (not node:$src2))>; 676def nand : PatFrag<(ops node:$src1, node:$src2), 677 (not (and node:$src1, node:$src2))>; 678def nor : PatFrag<(ops node:$src1, node:$src2), 679 (not (or node:$src1, node:$src2))>; 680def nxor : PatFrag<(ops node:$src1, node:$src2), 681 (not (xor node:$src1, node:$src2))>; 682 683// Fused multiply-subtract, using the natural operand order. 684def any_fms : PatFrag<(ops node:$src1, node:$src2, node:$src3), 685 (any_fma node:$src1, node:$src2, (fneg node:$src3))>; 686 687// Fused multiply-add and multiply-subtract, but with the order of the 688// operands matching SystemZ's MA and MS instructions. 689def z_any_fma : PatFrag<(ops node:$src1, node:$src2, node:$src3), 690 (any_fma node:$src2, node:$src3, node:$src1)>; 691def z_any_fms : PatFrag<(ops node:$src1, node:$src2, node:$src3), 692 (any_fma node:$src2, node:$src3, (fneg node:$src1))>; 693 694// Negative fused multiply-add and multiply-subtract. 695def any_fnma : PatFrag<(ops node:$src1, node:$src2, node:$src3), 696 (fneg (any_fma node:$src1, node:$src2, node:$src3))>; 697def any_fnms : PatFrag<(ops node:$src1, node:$src2, node:$src3), 698 (fneg (any_fms node:$src1, node:$src2, node:$src3))>; 699 700// Floating-point negative absolute. 701def fnabs : PatFrag<(ops node:$ptr), (fneg (fabs node:$ptr))>; 702 703// Strict floating-point fragments. 704def z_any_fcmp : PatFrags<(ops node:$lhs, node:$rhs), 705 [(z_strict_fcmp node:$lhs, node:$rhs), 706 (z_fcmp node:$lhs, node:$rhs)]>; 707def z_any_vfcmpe : PatFrags<(ops node:$lhs, node:$rhs), 708 [(z_strict_vfcmpe node:$lhs, node:$rhs), 709 (z_vfcmpe node:$lhs, node:$rhs)]>; 710def z_any_vfcmph : PatFrags<(ops node:$lhs, node:$rhs), 711 [(z_strict_vfcmph node:$lhs, node:$rhs), 712 (z_vfcmph node:$lhs, node:$rhs)]>; 713def z_any_vfcmphe : PatFrags<(ops node:$lhs, node:$rhs), 714 [(z_strict_vfcmphe node:$lhs, node:$rhs), 715 (z_vfcmphe node:$lhs, node:$rhs)]>; 716def z_any_vextend : PatFrags<(ops node:$src), 717 [(z_strict_vextend node:$src), 718 (z_vextend node:$src)]>; 719def z_any_vround : PatFrags<(ops node:$src), 720 [(z_strict_vround node:$src), 721 (z_vround node:$src)]>; 722 723// Create a unary operator that loads from memory and then performs 724// the given operation on it. 725class loadu<SDPatternOperator operator, SDPatternOperator load = load> 726 : PatFrag<(ops node:$addr), (operator (load node:$addr))>; 727 728// Create a store operator that performs the given unary operation 729// on the value before storing it. 730class storeu<SDPatternOperator operator, SDPatternOperator store = store> 731 : PatFrag<(ops node:$value, node:$addr), 732 (store (operator node:$value), node:$addr)>; 733 734// Create a store operator that performs the given inherent operation 735// and stores the resulting value. 736class storei<SDPatternOperator operator, SDPatternOperator store = store> 737 : PatFrag<(ops node:$addr), 738 (store (operator), node:$addr)>; 739 740// Create a shift operator that optionally ignores an AND of the 741// shift count with an immediate if the bottom 6 bits are all set. 742def imm32bottom6set : PatLeaf<(i32 imm), [{ 743 return (N->getZExtValue() & 0x3f) == 0x3f; 744}]>; 745class shiftop<SDPatternOperator operator> 746 : PatFrags<(ops node:$val, node:$count), 747 [(operator node:$val, node:$count), 748 (operator node:$val, (and node:$count, imm32bottom6set))]>; 749 750def imm32mod64 : PatLeaf<(i32 imm), [{ 751 return (N->getZExtValue() % 64 == 0); 752}]>; 753 754// Load a scalar and replicate it in all elements of a vector. 755class z_replicate_load<ValueType scalartype, SDPatternOperator load> 756 : PatFrag<(ops node:$addr), 757 (z_replicate (scalartype (load node:$addr)))>; 758def z_replicate_loadi8 : z_replicate_load<i32, anyextloadi8>; 759def z_replicate_loadi16 : z_replicate_load<i32, anyextloadi16>; 760def z_replicate_loadi32 : z_replicate_load<i32, load>; 761def z_replicate_loadi64 : z_replicate_load<i64, load>; 762def z_replicate_loadf32 : z_replicate_load<f32, load>; 763def z_replicate_loadf64 : z_replicate_load<f64, load>; 764// Byte-swapped replicated vector element loads. 765def z_replicate_loadbswapi16 : z_replicate_load<i32, z_loadbswap16>; 766def z_replicate_loadbswapi32 : z_replicate_load<i32, z_loadbswap32>; 767def z_replicate_loadbswapi64 : z_replicate_load<i64, z_loadbswap64>; 768 769// Load a scalar and insert it into a single element of a vector. 770class z_vle<ValueType scalartype, SDPatternOperator load> 771 : PatFrag<(ops node:$vec, node:$addr, node:$index), 772 (z_vector_insert node:$vec, (scalartype (load node:$addr)), 773 node:$index)>; 774def z_vlei8 : z_vle<i32, anyextloadi8>; 775def z_vlei16 : z_vle<i32, anyextloadi16>; 776def z_vlei32 : z_vle<i32, load>; 777def z_vlei64 : z_vle<i64, load>; 778def z_vlef32 : z_vle<f32, load>; 779def z_vlef64 : z_vle<f64, load>; 780// Byte-swapped vector element loads. 781def z_vlebri16 : z_vle<i32, z_loadbswap16>; 782def z_vlebri32 : z_vle<i32, z_loadbswap32>; 783def z_vlebri64 : z_vle<i64, z_loadbswap64>; 784 785// Load a scalar and insert it into the low element of the high i64 of a 786// zeroed vector. 787class z_vllez<ValueType scalartype, SDPatternOperator load, int index> 788 : PatFrag<(ops node:$addr), 789 (z_vector_insert immAllZerosV, 790 (scalartype (load node:$addr)), (i32 index))>; 791def z_vllezi8 : z_vllez<i32, anyextloadi8, 7>; 792def z_vllezi16 : z_vllez<i32, anyextloadi16, 3>; 793def z_vllezi32 : z_vllez<i32, load, 1>; 794def z_vllezi64 : PatFrags<(ops node:$addr), 795 [(z_vector_insert immAllZerosV, 796 (i64 (load node:$addr)), (i32 0)), 797 (z_join_dwords (i64 (load node:$addr)), (i64 0))]>; 798// We use high merges to form a v4f32 from four f32s. Propagating zero 799// into all elements but index 1 gives this expression. 800def z_vllezf32 : PatFrag<(ops node:$addr), 801 (z_merge_high 802 (v2i64 803 (z_unpackl_high 804 (v4i32 805 (bitconvert 806 (v4f32 (scalar_to_vector 807 (f32 (load node:$addr)))))))), 808 (v2i64 809 (bitconvert (v4f32 immAllZerosV))))>; 810def z_vllezf64 : PatFrag<(ops node:$addr), 811 (z_merge_high 812 (v2f64 (scalar_to_vector (f64 (load node:$addr)))), 813 immAllZerosV)>; 814 815// Similarly for the high element of a zeroed vector. 816def z_vllezli32 : z_vllez<i32, load, 0>; 817def z_vllezlf32 : PatFrag<(ops node:$addr), 818 (z_merge_high 819 (v2i64 820 (bitconvert 821 (z_merge_high 822 (v4f32 (scalar_to_vector 823 (f32 (load node:$addr)))), 824 (v4f32 immAllZerosV)))), 825 (v2i64 826 (bitconvert (v4f32 immAllZerosV))))>; 827 828// Byte-swapped variants. 829def z_vllebrzi16 : z_vllez<i32, z_loadbswap16, 3>; 830def z_vllebrzi32 : z_vllez<i32, z_loadbswap32, 1>; 831def z_vllebrzli32 : z_vllez<i32, z_loadbswap32, 0>; 832def z_vllebrzi64 : PatFrags<(ops node:$addr), 833 [(z_vector_insert immAllZerosV, 834 (i64 (z_loadbswap64 node:$addr)), 835 (i32 0)), 836 (z_join_dwords (i64 (z_loadbswap64 node:$addr)), 837 (i64 0))]>; 838 839 840// Store one element of a vector. 841class z_vste<ValueType scalartype, SDPatternOperator store> 842 : PatFrag<(ops node:$vec, node:$addr, node:$index), 843 (store (scalartype (z_vector_extract node:$vec, node:$index)), 844 node:$addr)>; 845def z_vstei8 : z_vste<i32, truncstorei8>; 846def z_vstei16 : z_vste<i32, truncstorei16>; 847def z_vstei32 : z_vste<i32, store>; 848def z_vstei64 : z_vste<i64, store>; 849def z_vstef32 : z_vste<f32, store>; 850def z_vstef64 : z_vste<f64, store>; 851// Byte-swapped vector element stores. 852def z_vstebri16 : z_vste<i32, z_storebswap16>; 853def z_vstebri32 : z_vste<i32, z_storebswap32>; 854def z_vstebri64 : z_vste<i64, z_storebswap64>; 855 856// Arithmetic negation on vectors. 857def z_vneg : PatFrag<(ops node:$x), (sub immAllZerosV, node:$x)>; 858 859// Bitwise negation on vectors. 860def z_vnot : PatFrag<(ops node:$x), (xor node:$x, immAllOnesV)>; 861 862// Signed "integer greater than zero" on vectors. 863def z_vicmph_zero : PatFrag<(ops node:$x), (z_vicmph node:$x, immAllZerosV)>; 864 865// Signed "integer less than zero" on vectors. 866def z_vicmpl_zero : PatFrag<(ops node:$x), (z_vicmph immAllZerosV, node:$x)>; 867 868// Sign-extend the i64 elements of a vector. 869class z_vse<int shift> 870 : PatFrag<(ops node:$src), 871 (z_vsra_by_scalar (z_vshl_by_scalar node:$src, shift), shift)>; 872def z_vsei8 : z_vse<56>; 873def z_vsei16 : z_vse<48>; 874def z_vsei32 : z_vse<32>; 875 876// ...and again with the extensions being done on individual i64 scalars. 877class z_vse_by_parts<SDPatternOperator operator, int index1, int index2> 878 : PatFrag<(ops node:$src), 879 (z_join_dwords 880 (operator (z_vector_extract node:$src, index1)), 881 (operator (z_vector_extract node:$src, index2)))>; 882def z_vsei8_by_parts : z_vse_by_parts<sext8dbl, 7, 15>; 883def z_vsei16_by_parts : z_vse_by_parts<sext16dbl, 3, 7>; 884def z_vsei32_by_parts : z_vse_by_parts<sext32, 1, 3>; 885