// WebAssemblyInstrAtomics.td-WebAssembly Atomic codegen support-*- tablegen -*- // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// WebAssembly Atomic operand code-gen constructs. /// //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // Atomic loads //===----------------------------------------------------------------------===// let Defs = [ARGUMENTS] in { defm ATOMIC_LOAD_I32 : WebAssemblyLoad; defm ATOMIC_LOAD_I64 : WebAssemblyLoad; } // Defs = [ARGUMENTS] // Select loads with no constant offset. let Predicates = [HasAtomics] in { def : LoadPatNoOffset; def : LoadPatNoOffset; // Select loads with a constant offset. // Pattern with address + immediate offset def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatExternalSym; def : LoadPatExternalSym; // Select loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; } // Predicates = [HasAtomics] // Extending loads. Note that there are only zero-extending atomic loads, no // sign-extending loads. let Defs = [ARGUMENTS] in { defm ATOMIC_LOAD8_U_I32 : WebAssemblyLoad; defm ATOMIC_LOAD16_U_I32 : WebAssemblyLoad; defm ATOMIC_LOAD8_U_I64 : WebAssemblyLoad; defm ATOMIC_LOAD16_U_I64 : WebAssemblyLoad; defm ATOMIC_LOAD32_U_I64 : WebAssemblyLoad; } // Defs = [ARGUMENTS] // Fragments for extending loads. These are different from regular loads because // the SDNodes are derived from AtomicSDNode rather than LoadSDNode and // therefore don't have the extension type field. So instead of matching that, // we match the patterns that the type legalizer expands them to. // We directly match zext patterns and select the zext atomic loads. // i32 (zext (i8 (atomic_load_8))) gets legalized to // i32 (and (i32 (atomic_load_8)), 255) // These can be selected to a single zero-extending atomic load instruction. def zext_aload_8_32 : PatFrag<(ops node:$addr), (and (i32 (atomic_load_8 node:$addr)), 255)>; def zext_aload_16_32 : PatFrag<(ops node:$addr), (and (i32 (atomic_load_16 node:$addr)), 65535)>; // Unlike regular loads, extension to i64 is handled differently than i32. // i64 (zext (i8 (atomic_load_8))) gets legalized to // i64 (and (i64 (anyext (i32 (atomic_load_8)))), 255) def zext_aload_8_64 : PatFrag<(ops node:$addr), (and (i64 (anyext (i32 (atomic_load_8 node:$addr)))), 255)>; def zext_aload_16_64 : PatFrag<(ops node:$addr), (and (i64 (anyext (i32 (atomic_load_16 node:$addr)))), 65535)>; def zext_aload_32_64 : PatFrag<(ops node:$addr), (zext (i32 (atomic_load node:$addr)))>; // We don't have single sext atomic load instructions. So for sext loads, we // match bare subword loads (for 32-bit results) and anyext loads (for 64-bit // results) and select a zext load; the next instruction will be sext_inreg // which is selected by itself. def sext_aload_8_64 : PatFrag<(ops node:$addr), (anyext (i32 (atomic_load_8 node:$addr)))>; def sext_aload_16_64 : PatFrag<(ops node:$addr), (anyext (i32 (atomic_load_16 node:$addr)))>; let Predicates = [HasAtomics] in { // Select zero-extending loads with no constant offset. def : LoadPatNoOffset; def : LoadPatNoOffset; def : LoadPatNoOffset; def : LoadPatNoOffset; def : LoadPatNoOffset; // Select sign-extending loads with no constant offset def : LoadPatNoOffset; def : LoadPatNoOffset; def : LoadPatNoOffset; def : LoadPatNoOffset; // 32->64 sext load gets selected as i32.atomic.load, i64.extend_s/i32 // Zero-extending loads with constant offset def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; // Sign-extending loads with constant offset def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; // No 32->64 patterns, just use i32.atomic.load and i64.extend_s/i64 def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; def : LoadPatExternalSym; // Extending loads with just a constant offset def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; def : LoadPatExternSymOffOnly; } // Predicates = [HasAtomics] //===----------------------------------------------------------------------===// // Atomic stores //===----------------------------------------------------------------------===// let Defs = [ARGUMENTS] in { defm ATOMIC_STORE_I32 : WebAssemblyStore; defm ATOMIC_STORE_I64 : WebAssemblyStore; } // Defs = [ARGUMENTS] // We need an 'atomic' version of store patterns because store and atomic_store // nodes have different operand orders: // store: (store $val, $ptr) // atomic_store: (store $ptr, $val) let Predicates = [HasAtomics] in { // Select stores with no constant offset. class AStorePatNoOffset : Pat<(kind I32:$addr, ty:$val), (inst 0, 0, I32:$addr, ty:$val)>; def : AStorePatNoOffset; def : AStorePatNoOffset; // Select stores with a constant offset. // Pattern with address + immediate offset class AStorePatImmOff : Pat<(kind (operand I32:$addr, imm:$off), ty:$val), (inst 0, imm:$off, I32:$addr, ty:$val)>; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; class AStorePatGlobalAddr : Pat<(kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), ty:$val), (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>; def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; class AStorePatExternalSym : Pat<(kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), ty:$val), (inst 0, texternalsym:$off, I32:$addr, ty:$val)>; def : AStorePatExternalSym; def : AStorePatExternalSym; // Select stores with just a constant offset. class AStorePatOffsetOnly : Pat<(kind imm:$off, ty:$val), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; class AStorePatGlobalAddrOffOnly : Pat<(kind (WebAssemblywrapper tglobaladdr:$off), ty:$val), (inst 0, tglobaladdr:$off, (CONST_I32 0), ty:$val)>; def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; class AStorePatExternSymOffOnly : Pat<(kind (WebAssemblywrapper texternalsym:$off), ty:$val), (inst 0, texternalsym:$off, (CONST_I32 0), ty:$val)>; def : AStorePatExternSymOffOnly; def : AStorePatExternSymOffOnly; } // Predicates = [HasAtomics] // Truncating stores. let Defs = [ARGUMENTS] in { defm ATOMIC_STORE8_I32 : WebAssemblyStore; defm ATOMIC_STORE16_I32 : WebAssemblyStore; defm ATOMIC_STORE8_I64 : WebAssemblyStore; defm ATOMIC_STORE16_I64 : WebAssemblyStore; defm ATOMIC_STORE32_I64 : WebAssemblyStore; } // Defs = [ARGUMENTS] // Fragments for truncating stores. // We don't have single truncating atomic store instructions. For 32-bit // instructions, we just need to match bare atomic stores. On the other hand, // truncating stores from i64 values are once truncated to i32 first. class trunc_astore_64 : PatFrag<(ops node:$addr, node:$val), (kind node:$addr, (i32 (trunc (i64 node:$val))))>; def trunc_astore_8_64 : trunc_astore_64; def trunc_astore_16_64 : trunc_astore_64; def trunc_astore_32_64 : trunc_astore_64; let Predicates = [HasAtomics] in { // Truncating stores with no constant offset def : AStorePatNoOffset; def : AStorePatNoOffset; def : AStorePatNoOffset; def : AStorePatNoOffset; def : AStorePatNoOffset; // Truncating stores with a constant offset def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatImmOff; def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; def : AStorePatExternalSym; def : AStorePatExternalSym; def : AStorePatExternalSym; def : AStorePatExternalSym; def : AStorePatExternalSym; // Truncating stores with just a constant offset def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; def : AStorePatExternSymOffOnly; def : AStorePatExternSymOffOnly; def : AStorePatExternSymOffOnly; def : AStorePatExternSymOffOnly; def : AStorePatExternSymOffOnly; } // Predicates = [HasAtomics] //===----------------------------------------------------------------------===// // Atomic binary read-modify-writes //===----------------------------------------------------------------------===// let Defs = [ARGUMENTS] in { multiclass WebAssemblyBinRMW { defm "" : I<(outs rc:$dst), (ins P2Align:$p2align, offset32_op:$off, I32:$addr, rc:$val), (outs), (ins P2Align:$p2align, offset32_op:$off), [], !strconcat(Name, "\t$dst, ${off}(${addr})${p2align}, $val"), !strconcat(Name, "\t${off}, ${p2align}"), Opcode>; } defm ATOMIC_RMW_ADD_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_ADD_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_ADD_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_ADD_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_ADD_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_ADD_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_ADD_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW_SUB_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_SUB_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_SUB_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_SUB_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_SUB_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_SUB_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_SUB_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW_AND_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_AND_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_AND_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_AND_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_AND_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_AND_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_AND_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW_OR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_OR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_OR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_OR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_OR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_OR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_OR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW_XOR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_XOR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_XOR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_XOR_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_XOR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_XOR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_XOR_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW_XCHG_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW_XCHG_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_XCHG_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_XCHG_I32 : WebAssemblyBinRMW; defm ATOMIC_RMW8_U_XCHG_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW16_U_XCHG_I64 : WebAssemblyBinRMW; defm ATOMIC_RMW32_U_XCHG_I64 : WebAssemblyBinRMW; } // Select binary RMWs with no constant offset. class BinRMWPatNoOffset : Pat<(ty (kind I32:$addr, ty:$val)), (inst 0, 0, I32:$addr, ty:$val)>; // Select binary RMWs with a constant offset. // Pattern with address + immediate offset class BinRMWPatImmOff : Pat<(ty (kind (operand I32:$addr, imm:$off), ty:$val)), (inst 0, imm:$off, I32:$addr, ty:$val)>; class BinRMWPatGlobalAddr : Pat<(ty (kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), ty:$val)), (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>; class BinRMWPatExternalSym : Pat<(ty (kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), ty:$val)), (inst 0, texternalsym:$off, I32:$addr, ty:$val)>; // Select binary RMWs with just a constant offset. class BinRMWPatOffsetOnly : Pat<(ty (kind imm:$off, ty:$val)), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; class BinRMWPatGlobalAddrOffOnly : Pat<(ty (kind (WebAssemblywrapper tglobaladdr:$off), ty:$val)), (inst 0, tglobaladdr:$off, (CONST_I32 0), ty:$val)>; class BinRMWPatExternSymOffOnly : Pat<(ty (kind (WebAssemblywrapper texternalsym:$off), ty:$val)), (inst 0, texternalsym:$off, (CONST_I32 0), ty:$val)>; // Patterns for various addressing modes. multiclass BinRMWPattern { def : BinRMWPatNoOffset; def : BinRMWPatNoOffset; def : BinRMWPatImmOff; def : BinRMWPatImmOff; def : BinRMWPatImmOff; def : BinRMWPatImmOff; def : BinRMWPatGlobalAddr; def : BinRMWPatGlobalAddr; def : BinRMWPatExternalSym; def : BinRMWPatExternalSym; def : BinRMWPatOffsetOnly; def : BinRMWPatOffsetOnly; def : BinRMWPatGlobalAddrOffOnly; def : BinRMWPatGlobalAddrOffOnly; def : BinRMWPatExternSymOffOnly; def : BinRMWPatExternSymOffOnly; } let Predicates = [HasAtomics] in { defm : BinRMWPattern; defm : BinRMWPattern; defm : BinRMWPattern; defm : BinRMWPattern; defm : BinRMWPattern; defm : BinRMWPattern; } // Predicates = [HasAtomics] // Truncating & zero-extending binary RMW patterns. // These are combined patterns of truncating store patterns and zero-extending // load patterns above. class zext_bin_rmw_8_32 : PatFrag<(ops node:$addr, node:$val), (and (i32 (kind node:$addr, node:$val)), 255)>; class zext_bin_rmw_16_32 : PatFrag<(ops node:$addr, node:$val), (and (i32 (kind node:$addr, node:$val)), 65535)>; class zext_bin_rmw_8_64 : PatFrag<(ops node:$addr, node:$val), (and (i64 (anyext (i32 (kind node:$addr, (i32 (trunc (i64 node:$val))))))), 255)>; class zext_bin_rmw_16_64 : PatFrag<(ops node:$addr, node:$val), (and (i64 (anyext (i32 (kind node:$addr, (i32 (trunc (i64 node:$val))))))), 65535)>; class zext_bin_rmw_32_64 : PatFrag<(ops node:$addr, node:$val), (zext (i32 (kind node:$addr, (i32 (trunc (i64 node:$val))))))>; // Truncating & sign-extending binary RMW patterns. // These are combined patterns of truncating store patterns and sign-extending // load patterns above. We match subword RMWs (for 32-bit) and anyext RMWs (for // 64-bit) and select a zext RMW; the next instruction will be sext_inreg which // is selected by itself. class sext_bin_rmw_8_32 : PatFrag<(ops node:$addr, node:$val), (kind node:$addr, node:$val)>; class sext_bin_rmw_16_32 : sext_bin_rmw_8_32; class sext_bin_rmw_8_64 : PatFrag<(ops node:$addr, node:$val), (anyext (i32 (kind node:$addr, (i32 (trunc (i64 node:$val))))))>; class sext_bin_rmw_16_64 : sext_bin_rmw_8_64; // 32->64 sext RMW gets selected as i32.atomic.rmw.***, i64.extend_s/i32 // Patterns for various addressing modes for truncating-extending binary RMWs. multiclass BinRMWTruncExtPattern< PatFrag rmw_8, PatFrag rmw_16, PatFrag rmw_32, PatFrag rmw_64, NI inst8_32, NI inst16_32, NI inst8_64, NI inst16_64, NI inst32_64> { // Truncating-extending binary RMWs with no constant offset def : BinRMWPatNoOffset, inst8_32>; def : BinRMWPatNoOffset, inst16_32>; def : BinRMWPatNoOffset, inst8_64>; def : BinRMWPatNoOffset, inst16_64>; def : BinRMWPatNoOffset, inst32_64>; def : BinRMWPatNoOffset, inst8_32>; def : BinRMWPatNoOffset, inst16_32>; def : BinRMWPatNoOffset, inst8_64>; def : BinRMWPatNoOffset, inst16_64>; // Truncating-extending binary RMWs with a constant offset def : BinRMWPatImmOff, regPlusImm, inst8_32>; def : BinRMWPatImmOff, regPlusImm, inst16_32>; def : BinRMWPatImmOff, regPlusImm, inst8_64>; def : BinRMWPatImmOff, regPlusImm, inst16_64>; def : BinRMWPatImmOff, regPlusImm, inst32_64>; def : BinRMWPatImmOff, or_is_add, inst8_32>; def : BinRMWPatImmOff, or_is_add, inst16_32>; def : BinRMWPatImmOff, or_is_add, inst8_64>; def : BinRMWPatImmOff, or_is_add, inst16_64>; def : BinRMWPatImmOff, or_is_add, inst32_64>; def : BinRMWPatImmOff, regPlusImm, inst8_32>; def : BinRMWPatImmOff, regPlusImm, inst16_32>; def : BinRMWPatImmOff, regPlusImm, inst8_64>; def : BinRMWPatImmOff, regPlusImm, inst16_64>; def : BinRMWPatImmOff, or_is_add, inst8_32>; def : BinRMWPatImmOff, or_is_add, inst16_32>; def : BinRMWPatImmOff, or_is_add, inst8_64>; def : BinRMWPatImmOff, or_is_add, inst16_64>; def : BinRMWPatGlobalAddr, inst8_32>; def : BinRMWPatGlobalAddr, inst16_32>; def : BinRMWPatGlobalAddr, inst8_64>; def : BinRMWPatGlobalAddr, inst16_64>; def : BinRMWPatGlobalAddr, inst32_64>; def : BinRMWPatGlobalAddr, inst8_32>; def : BinRMWPatGlobalAddr, inst16_32>; def : BinRMWPatGlobalAddr, inst8_64>; def : BinRMWPatGlobalAddr, inst16_64>; def : BinRMWPatExternalSym, inst8_32>; def : BinRMWPatExternalSym, inst16_32>; def : BinRMWPatExternalSym, inst8_64>; def : BinRMWPatExternalSym, inst16_64>; def : BinRMWPatExternalSym, inst32_64>; def : BinRMWPatExternalSym, inst8_32>; def : BinRMWPatExternalSym, inst16_32>; def : BinRMWPatExternalSym, inst8_64>; def : BinRMWPatExternalSym, inst16_64>; // Truncating-extending binary RMWs with just a constant offset def : BinRMWPatOffsetOnly, inst8_32>; def : BinRMWPatOffsetOnly, inst16_32>; def : BinRMWPatOffsetOnly, inst8_64>; def : BinRMWPatOffsetOnly, inst16_64>; def : BinRMWPatOffsetOnly, inst32_64>; def : BinRMWPatOffsetOnly, inst8_32>; def : BinRMWPatOffsetOnly, inst16_32>; def : BinRMWPatOffsetOnly, inst8_64>; def : BinRMWPatOffsetOnly, inst16_64>; def : BinRMWPatGlobalAddrOffOnly, inst8_32>; def : BinRMWPatGlobalAddrOffOnly, inst16_32>; def : BinRMWPatGlobalAddrOffOnly, inst8_64>; def : BinRMWPatGlobalAddrOffOnly, inst16_64>; def : BinRMWPatGlobalAddrOffOnly, inst32_64>; def : BinRMWPatGlobalAddrOffOnly, inst8_32>; def : BinRMWPatGlobalAddrOffOnly, inst16_32>; def : BinRMWPatGlobalAddrOffOnly, inst8_64>; def : BinRMWPatGlobalAddrOffOnly, inst16_64>; def : BinRMWPatExternSymOffOnly, inst8_32>; def : BinRMWPatExternSymOffOnly, inst16_32>; def : BinRMWPatExternSymOffOnly, inst8_64>; def : BinRMWPatExternSymOffOnly, inst16_64>; def : BinRMWPatExternSymOffOnly, inst32_64>; def : BinRMWPatExternSymOffOnly, inst8_32>; def : BinRMWPatExternSymOffOnly, inst16_32>; def : BinRMWPatExternSymOffOnly, inst8_64>; def : BinRMWPatExternSymOffOnly, inst16_64>; } let Predicates = [HasAtomics] in { defm : BinRMWTruncExtPattern< atomic_load_add_8, atomic_load_add_16, atomic_load_add_32, atomic_load_add_64, ATOMIC_RMW8_U_ADD_I32, ATOMIC_RMW16_U_ADD_I32, ATOMIC_RMW8_U_ADD_I64, ATOMIC_RMW16_U_ADD_I64, ATOMIC_RMW32_U_ADD_I64>; defm : BinRMWTruncExtPattern< atomic_load_sub_8, atomic_load_sub_16, atomic_load_sub_32, atomic_load_sub_64, ATOMIC_RMW8_U_SUB_I32, ATOMIC_RMW16_U_SUB_I32, ATOMIC_RMW8_U_SUB_I64, ATOMIC_RMW16_U_SUB_I64, ATOMIC_RMW32_U_SUB_I64>; defm : BinRMWTruncExtPattern< atomic_load_and_8, atomic_load_and_16, atomic_load_and_32, atomic_load_and_64, ATOMIC_RMW8_U_AND_I32, ATOMIC_RMW16_U_AND_I32, ATOMIC_RMW8_U_AND_I64, ATOMIC_RMW16_U_AND_I64, ATOMIC_RMW32_U_AND_I64>; defm : BinRMWTruncExtPattern< atomic_load_or_8, atomic_load_or_16, atomic_load_or_32, atomic_load_or_64, ATOMIC_RMW8_U_OR_I32, ATOMIC_RMW16_U_OR_I32, ATOMIC_RMW8_U_OR_I64, ATOMIC_RMW16_U_OR_I64, ATOMIC_RMW32_U_OR_I64>; defm : BinRMWTruncExtPattern< atomic_load_xor_8, atomic_load_xor_16, atomic_load_xor_32, atomic_load_xor_64, ATOMIC_RMW8_U_XOR_I32, ATOMIC_RMW16_U_XOR_I32, ATOMIC_RMW8_U_XOR_I64, ATOMIC_RMW16_U_XOR_I64, ATOMIC_RMW32_U_XOR_I64>; defm : BinRMWTruncExtPattern< atomic_swap_8, atomic_swap_16, atomic_swap_32, atomic_swap_64, ATOMIC_RMW8_U_XCHG_I32, ATOMIC_RMW16_U_XCHG_I32, ATOMIC_RMW8_U_XCHG_I64, ATOMIC_RMW16_U_XCHG_I64, ATOMIC_RMW32_U_XCHG_I64>; } // Predicates = [HasAtomics]