diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td @@ -11,27 +11,6 @@ /// //===----------------------------------------------------------------------===// -// WebAssembly constant offsets are performed as unsigned with infinite -// precision, so we need to check for NoUnsignedWrap so that we don't fold an -// offset for an add that needs wrapping. -def regPlusImm : PatFrag<(ops node:$addr, node:$off), - (add node:$addr, node:$off), - [{ return N->getFlags().hasNoUnsignedWrap(); }]>; - - -// Treat an 'or' node as an 'add' if the or'ed bits are known to be zero. -def or_is_add : PatFrag<(ops node:$lhs, node:$rhs), (or node:$lhs, node:$rhs),[{ - if (ConstantSDNode *CN = dyn_cast(N->getOperand(1))) - return CurDAG->MaskedValueIsZero(N->getOperand(0), CN->getAPIntValue()); - - KnownBits Known0 = CurDAG->computeKnownBits(N->getOperand(0), 0); - KnownBits Known1 = CurDAG->computeKnownBits(N->getOperand(1), 0); - return (~Known0.Zero & ~Known1.Zero) == 0; -}]>; - -// We don't need a regPlusES because external symbols never have constant -// offsets folded into them, so we can just use add. - let UseNamedOperandTable = 1 in multiclass ATOMIC_I pattern_r, string asmstr_r, @@ -98,129 +77,29 @@ } // mayLoad = 1 } // hasSideEffects = 1 -// Select notifys with no constant offset. -def NotifyPatNoOffset_A32 : - Pat<(i32 (int_wasm_memory_atomic_notify I32:$addr, I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A32 0, 0, I32:$addr, I32:$count)>, +def NotifyPat_A32 : + Pat<(i32 (int_wasm_memory_atomic_notify (AddrOps32 offset32_op:$offset, I32:$addr), I32:$count)), + (MEMORY_ATOMIC_NOTIFY_A32 0, $offset, $addr, $count)>, Requires<[HasAddr32, HasAtomics]>; -def NotifyPatNoOffset_A64 : - Pat<(i32 (int_wasm_memory_atomic_notify I64:$addr, I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A64 0, 0, I64:$addr, I32:$count)>, +def NotifyPat_A64 : + Pat<(i32 (int_wasm_memory_atomic_notify (AddrOps64 offset64_op:$offset, I64:$addr), I32:$count)), + (MEMORY_ATOMIC_NOTIFY_A64 0, $offset, $addr, $count)>, Requires<[HasAddr64, HasAtomics]>; -// Select notifys with a constant offset. -// Pattern with address + immediate offset -multiclass NotifyPatImmOff { - def : Pat<(i32 (int_wasm_memory_atomic_notify (operand I32:$addr, imm:$off), - I32:$count)), - (!cast(inst#_A32) 0, imm:$off, I32:$addr, I32:$count)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(i32 (int_wasm_memory_atomic_notify (operand I64:$addr, imm:$off), - I32:$count)), - (!cast(inst#_A64) 0, imm:$off, I64:$addr, I32:$count)>, - Requires<[HasAddr64, HasAtomics]>; +multiclass WaitPat { + def WaitPat_A32 : + Pat<(i32 (kind (AddrOps32 offset32_op:$offset, I32:$addr), ty:$exp, I64:$timeout)), + (!cast(inst#_A32) 0, $offset, $addr, $exp, $timeout)>, + Requires<[HasAddr32, HasAtomics]>; + def WaitPat_A64 : + Pat<(i32 (kind (AddrOps64 offset64_op:$offset, I64:$addr), ty:$exp, I64:$timeout)), + (!cast(inst#_A64) 0, $offset, $addr, $exp, $timeout)>, + Requires<[HasAddr64, HasAtomics]>; } -defm : NotifyPatImmOff; -defm : NotifyPatImmOff; -// Select notifys with just a constant offset. -def NotifyPatOffsetOnly_A32 : - Pat<(i32 (int_wasm_memory_atomic_notify imm:$off, I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A32 0, imm:$off, (CONST_I32 0), I32:$count)>, - Requires<[HasAddr32, HasAtomics]>; -def NotifyPatOffsetOnly_A64 : - Pat<(i32 (int_wasm_memory_atomic_notify imm:$off, I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A64 0, imm:$off, (CONST_I64 0), I32:$count)>, - Requires<[HasAddr64, HasAtomics]>; - -def NotifyPatGlobalAddrOffOnly_A32 : - Pat<(i32 (int_wasm_memory_atomic_notify (WebAssemblyWrapper tglobaladdr:$off), - I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A32 0, tglobaladdr:$off, (CONST_I32 0), I32:$count) - >, - Requires<[HasAddr32, HasAtomics, IsNotPIC]>; -def NotifyPatGlobalAddrOffOnly_A64 : - Pat<(i32 (int_wasm_memory_atomic_notify (WebAssemblyWrapper tglobaladdr:$off), - I32:$count)), - (MEMORY_ATOMIC_NOTIFY_A64 0, tglobaladdr:$off, (CONST_I64 0), I32:$count) - >, - Requires<[HasAddr64, HasAtomics, IsNotPIC]>; - -// Select waits with no constant offset. -multiclass WaitPatNoOffset { - def : Pat<(i32 (kind I32:$addr, ty:$exp, I64:$timeout)), - (!cast(inst#_A32) 0, 0, I32:$addr, ty:$exp, I64:$timeout)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(i32 (kind I64:$addr, ty:$exp, I64:$timeout)), - (!cast(inst#_A64) 0, 0, I64:$addr, ty:$exp, I64:$timeout)>, - Requires<[HasAddr64, HasAtomics]>; -} -defm : WaitPatNoOffset; -defm : WaitPatNoOffset; -defm : WaitPatNoOffset; -defm : WaitPatNoOffset; - -// Select waits with a constant offset. - -// Pattern with address + immediate offset -multiclass WaitPatImmOff { - def : Pat<(i32 (kind (operand I32:$addr, imm:$off), ty:$exp, I64:$timeout)), - (!cast(inst#_A32) 0, imm:$off, I32:$addr, ty:$exp, - I64:$timeout)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(i32 (kind (operand I64:$addr, imm:$off), ty:$exp, I64:$timeout)), - (!cast(inst#_A64) 0, imm:$off, I64:$addr, ty:$exp, - I64:$timeout)>, - Requires<[HasAddr64, HasAtomics]>; -} -defm : WaitPatImmOff; -defm : WaitPatImmOff; -defm : WaitPatImmOff; -defm : WaitPatImmOff; - -// Select waits with just a constant offset. -multiclass WaitPatOffsetOnly { - def : Pat<(i32 (kind imm:$off, ty:$exp, I64:$timeout)), - (!cast(inst#_A32) 0, imm:$off, (CONST_I32 0), ty:$exp, - I64:$timeout)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(i32 (kind imm:$off, ty:$exp, I64:$timeout)), - (!cast(inst#_A64) 0, imm:$off, (CONST_I64 0), ty:$exp, - I64:$timeout)>, - Requires<[HasAddr64, HasAtomics]>; -} -defm : WaitPatOffsetOnly; -defm : WaitPatOffsetOnly; - -multiclass WaitPatGlobalAddrOffOnly { - def : Pat<(i32 (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$exp, - I64:$timeout)), - (!cast(inst#_A32) 0, tglobaladdr:$off, (CONST_I32 0), ty:$exp, - I64:$timeout)>, - Requires<[HasAddr32, HasAtomics, IsNotPIC]>; - def : Pat<(i32 (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$exp, - I64:$timeout)), - (!cast(inst#_A64) 0, tglobaladdr:$off, (CONST_I64 0), ty:$exp, - I64:$timeout)>, - Requires<[HasAddr64, HasAtomics, IsNotPIC]>; -} -defm : WaitPatGlobalAddrOffOnly; -defm : WaitPatGlobalAddrOffOnly; +defm : WaitPat; +defm : WaitPat; //===----------------------------------------------------------------------===// // Atomic fences @@ -318,57 +197,16 @@ // store: (store $val, $ptr) // atomic_store: (store $ptr, $val) - -// Select stores with no constant offset. -multiclass AStorePatNoOffset { - def : Pat<(kind I32:$addr, ty:$val), - (!cast(inst#_A32) 0, 0, I32:$addr, ty:$val)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(kind I64:$addr, ty:$val), - (!cast(inst#_A64) 0, 0, I64:$addr, ty:$val)>, - Requires<[HasAddr64, HasAtomics]>; -} -defm : AStorePatNoOffset; -defm : AStorePatNoOffset; - -// Select stores with a constant offset. - -// Pattern with address + immediate offset -multiclass AStorePatImmOff { - def : Pat<(kind (operand I32:$addr, imm:$off), ty:$val), - (!cast(inst#_A32) 0, imm:$off, I32:$addr, ty:$val)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(kind (operand I64:$addr, imm:$off), ty:$val), - (!cast(inst#_A64) 0, imm:$off, I64:$addr, ty:$val)>, - Requires<[HasAddr64, HasAtomics]>; -} -defm : AStorePatImmOff; -defm : AStorePatImmOff; - -// Select stores with just a constant offset. -multiclass AStorePatOffsetOnly { - def : Pat<(kind imm:$off, ty:$val), - (!cast(inst#_A32) 0, imm:$off, (CONST_I32 0), ty:$val)>, +multiclass AStorePat { + def : Pat<(kind (AddrOps32 offset32_op:$offset, I32:$addr), ty:$val), + (!cast(inst#_A32) 0, $offset, $addr, $val)>, Requires<[HasAddr32, HasAtomics]>; - def : Pat<(kind imm:$off, ty:$val), - (!cast(inst#_A64) 0, imm:$off, (CONST_I64 0), ty:$val)>, + def : Pat<(kind (AddrOps64 offset64_op:$offset, I64:$addr), ty:$val), + (!cast(inst#_A64) 0, $offset, $addr, $val)>, Requires<[HasAddr64, HasAtomics]>; } -defm : AStorePatOffsetOnly; -defm : AStorePatOffsetOnly; - -multiclass AStorePatGlobalAddrOffOnly { - def : Pat<(kind (WebAssemblyWrapper tglobaladdr:$off), ty:$val), - (!cast(inst#_A32) 0, tglobaladdr:$off, (CONST_I32 0), ty:$val)>, - Requires<[HasAddr32, HasAtomics, IsNotPIC]>; - def : Pat<(kind (WebAssemblyWrapper tglobaladdr:$off), ty:$val), - (!cast(inst#_A64) 0, tglobaladdr:$off, (CONST_I64 0), ty:$val)>, - Requires<[HasAddr64, HasAtomics, IsNotPIC]>; -} -defm : AStorePatGlobalAddrOffOnly; -defm : AStorePatGlobalAddrOffOnly; - +defm : AStorePat; +defm : AStorePat; // Truncating stores. defm ATOMIC_STORE8_I32 : AtomicStore; @@ -389,43 +227,12 @@ def trunc_astore_16_64 : trunc_astore_64; def trunc_astore_32_64 : trunc_astore_64; - // Truncating stores with no constant offset -defm : AStorePatNoOffset; -defm : AStorePatNoOffset; -defm : AStorePatNoOffset; -defm : AStorePatNoOffset; -defm : AStorePatNoOffset; - -// Truncating stores with a constant offset -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; -defm : AStorePatImmOff; - -// Truncating stores with just a constant offset -defm : AStorePatOffsetOnly; -defm : AStorePatOffsetOnly; -defm : AStorePatOffsetOnly; -defm : AStorePatOffsetOnly; -defm : AStorePatOffsetOnly; - -defm : AStorePatGlobalAddrOffOnly; -defm : AStorePatGlobalAddrOffOnly; -defm : AStorePatGlobalAddrOffOnly; -defm : AStorePatGlobalAddrOffOnly; -defm : AStorePatGlobalAddrOffOnly; - +defm : AStorePat; +defm : AStorePat; +defm : AStorePat; +defm : AStorePat; +defm : AStorePat; //===----------------------------------------------------------------------===// // Atomic binary read-modify-writes @@ -527,64 +334,20 @@ defm ATOMIC_RMW32_U_XCHG_I64 : WebAssemblyBinRMW; -// Select binary RMWs with no constant offset. -multiclass BinRMWPatNoOffset { - def : Pat<(ty (kind I32:$addr, ty:$val)), - (!cast(inst#_A32) 0, 0, I32:$addr, ty:$val)>, +multiclass BinRMWPat { + def : Pat<(ty (kind (AddrOps32 offset32_op:$offset, I32:$addr), ty:$val)), + (!cast(inst#_A32) 0, $offset, $addr, $val)>, Requires<[HasAddr32, HasAtomics]>; - def : Pat<(ty (kind I64:$addr, ty:$val)), - (!cast(inst#_A64) 0, 0, I64:$addr, ty:$val)>, + def : Pat<(ty (kind (AddrOps64 offset64_op:$offset, I64:$addr), ty:$val)), + (!cast(inst#_A64) 0, $offset, $addr, $val)>, Requires<[HasAddr64, HasAtomics]>; } -// Select binary RMWs with a constant offset. - -// Pattern with address + immediate offset -multiclass BinRMWPatImmOff { - def : Pat<(ty (kind (operand I32:$addr, imm:$off), ty:$val)), - (!cast(inst#_A32) 0, imm:$off, I32:$addr, ty:$val)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(ty (kind (operand I64:$addr, imm:$off), ty:$val)), - (!cast(inst#_A64) 0, imm:$off, I64:$addr, ty:$val)>, - Requires<[HasAddr64, HasAtomics]>; -} - -// Select binary RMWs with just a constant offset. -multiclass BinRMWPatOffsetOnly { - def : Pat<(ty (kind imm:$off, ty:$val)), - (!cast(inst#_A32) 0, imm:$off, (CONST_I32 0), ty:$val)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(ty (kind imm:$off, ty:$val)), - (!cast(inst#_A64) 0, imm:$off, (CONST_I64 0), ty:$val)>, - Requires<[HasAddr64, HasAtomics]>; -} - -multiclass BinRMWPatGlobalAddrOffOnly { - def : Pat<(ty (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$val)), - (!cast(inst#_A32) 0, tglobaladdr:$off, (CONST_I32 0), ty:$val)>, - Requires<[HasAddr32, HasAtomics, IsNotPIC]>; - def : Pat<(ty (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$val)), - (!cast(inst#_A64) 0, tglobaladdr:$off, (CONST_I64 0), ty:$val)>, - Requires<[HasAddr64, HasAtomics, IsNotPIC]>; -} - // Patterns for various addressing modes. multiclass BinRMWPattern { - defm : BinRMWPatNoOffset; - defm : BinRMWPatNoOffset; - - defm : BinRMWPatImmOff; - defm : BinRMWPatImmOff; - defm : BinRMWPatImmOff; - defm : BinRMWPatImmOff; - - defm : BinRMWPatOffsetOnly; - defm : BinRMWPatOffsetOnly; - - defm : BinRMWPatGlobalAddrOffOnly; - defm : BinRMWPatGlobalAddrOffOnly; + defm : BinRMWPat; + defm : BinRMWPat; } defm : BinRMWPattern { - // Truncating-extending binary RMWs with no constant offset - defm : BinRMWPatNoOffset, inst8_32>; - defm : BinRMWPatNoOffset, inst16_32>; - defm : BinRMWPatNoOffset, inst8_64>; - defm : BinRMWPatNoOffset, inst16_64>; - defm : BinRMWPatNoOffset, inst32_64>; - - defm : BinRMWPatNoOffset, inst8_32>; - defm : BinRMWPatNoOffset, inst16_32>; - defm : BinRMWPatNoOffset, inst8_64>; - defm : BinRMWPatNoOffset, inst16_64>; - - // Truncating-extending binary RMWs with a constant offset - defm : BinRMWPatImmOff, regPlusImm, inst8_32>; - defm : BinRMWPatImmOff, regPlusImm, - inst16_32>; - defm : BinRMWPatImmOff, regPlusImm, inst8_64>; - defm : BinRMWPatImmOff, regPlusImm, - inst16_64>; - defm : BinRMWPatImmOff, regPlusImm, - inst32_64>; - defm : BinRMWPatImmOff, or_is_add, inst8_32>; - defm : BinRMWPatImmOff, or_is_add, inst16_32>; - defm : BinRMWPatImmOff, or_is_add, inst8_64>; - defm : BinRMWPatImmOff, or_is_add, inst16_64>; - defm : BinRMWPatImmOff, or_is_add, inst32_64>; - - defm : BinRMWPatImmOff, regPlusImm, inst8_32>; - defm : BinRMWPatImmOff, regPlusImm, - inst16_32>; - defm : BinRMWPatImmOff, regPlusImm, inst8_64>; - defm : BinRMWPatImmOff, regPlusImm, - inst16_64>; - defm : BinRMWPatImmOff, or_is_add, inst8_32>; - defm : BinRMWPatImmOff, or_is_add, inst16_32>; - defm : BinRMWPatImmOff, or_is_add, inst8_64>; - defm : BinRMWPatImmOff, or_is_add, inst16_64>; - - // Truncating-extending binary RMWs with just a constant offset - defm : BinRMWPatOffsetOnly, inst8_32>; - defm : BinRMWPatOffsetOnly, inst16_32>; - defm : BinRMWPatOffsetOnly, inst8_64>; - defm : BinRMWPatOffsetOnly, inst16_64>; - defm : BinRMWPatOffsetOnly, inst32_64>; - - defm : BinRMWPatOffsetOnly, inst8_32>; - defm : BinRMWPatOffsetOnly, inst16_32>; - defm : BinRMWPatOffsetOnly, inst8_64>; - defm : BinRMWPatOffsetOnly, inst16_64>; - - defm : BinRMWPatGlobalAddrOffOnly, inst8_32>; - defm : BinRMWPatGlobalAddrOffOnly, inst16_32>; - defm : BinRMWPatGlobalAddrOffOnly, inst8_64>; - defm : BinRMWPatGlobalAddrOffOnly, inst16_64>; - defm : BinRMWPatGlobalAddrOffOnly, inst32_64>; - - defm : BinRMWPatGlobalAddrOffOnly, inst8_32>; - defm : BinRMWPatGlobalAddrOffOnly, inst16_32>; - defm : BinRMWPatGlobalAddrOffOnly, inst8_64>; - defm : BinRMWPatGlobalAddrOffOnly, inst16_64>; + // Truncating-extending binary RMWs + defm : BinRMWPat, inst8_32>; + defm : BinRMWPat, inst16_32>; + defm : BinRMWPat, inst8_64>; + defm : BinRMWPat, inst16_64>; + defm : BinRMWPat, inst32_64>; + + defm : BinRMWPat, inst8_32>; + defm : BinRMWPat, inst16_32>; + defm : BinRMWPat, inst8_64>; + defm : BinRMWPat, inst16_64>; } defm : BinRMWTruncExtPattern< @@ -761,70 +475,17 @@ defm ATOMIC_RMW32_U_CMPXCHG_I64 : WebAssemblyTerRMW; -// Select ternary RMWs with no constant offset. -multiclass TerRMWPatNoOffset { - def : Pat<(ty (kind I32:$addr, ty:$exp, ty:$new)), - (!cast(inst#_A32) 0, 0, I32:$addr, ty:$exp, ty:$new)>, +multiclass TerRMWPat { + def : Pat<(ty (kind (AddrOps32 offset32_op:$offset, I32:$addr), ty:$exp, ty:$new)), + (!cast(inst#_A32) 0, $offset, $addr, $exp, $new)>, Requires<[HasAddr32, HasAtomics]>; - def : Pat<(ty (kind I64:$addr, ty:$exp, ty:$new)), - (!cast(inst#_A64) 0, 0, I64:$addr, ty:$exp, ty:$new)>, + def : Pat<(ty (kind (AddrOps64 offset64_op:$offset, I64:$addr), ty:$exp, ty:$new)), + (!cast(inst#_A64) 0, $offset, $addr, $exp, $new)>, Requires<[HasAddr64, HasAtomics]>; } -// Select ternary RMWs with a constant offset. - -// Pattern with address + immediate offset -multiclass TerRMWPatImmOff { - def : Pat<(ty (kind (operand I32:$addr, imm:$off), ty:$exp, ty:$new)), - (!cast(inst#_A32) 0, imm:$off, I32:$addr, ty:$exp, ty:$new)>, - Requires<[HasAddr32, HasAtomics]>; - def : Pat<(ty (kind (operand I64:$addr, imm:$off), ty:$exp, ty:$new)), - (!cast(inst#_A64) 0, imm:$off, I64:$addr, ty:$exp, ty:$new)>, - Requires<[HasAddr64, HasAtomics]>; -} - -// Select ternary RMWs with just a constant offset. -multiclass TerRMWPatOffsetOnly { - def : Pat<(ty (kind imm:$off, ty:$exp, ty:$new)), - (!cast(inst#_A32) 0, imm:$off, (CONST_I32 0), ty:$exp, - ty:$new)>; - def : Pat<(ty (kind imm:$off, ty:$exp, ty:$new)), - (!cast(inst#_A64) 0, imm:$off, (CONST_I64 0), ty:$exp, - ty:$new)>; -} - -multiclass TerRMWPatGlobalAddrOffOnly { - def : Pat<(ty (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$exp, ty:$new)), - (!cast(inst#_A32) 0, tglobaladdr:$off, (CONST_I32 0), ty:$exp, - ty:$new)>, - Requires<[HasAddr32, HasAtomics, IsNotPIC]>; - def : Pat<(ty (kind (WebAssemblyWrapper tglobaladdr:$off), ty:$exp, ty:$new)), - (!cast(inst#_A64) 0, tglobaladdr:$off, (CONST_I64 0), ty:$exp, - ty:$new)>, - Requires<[HasAddr64, HasAtomics, IsNotPIC]>; -} - -// Patterns for various addressing modes. -multiclass TerRMWPattern { - defm : TerRMWPatNoOffset; - defm : TerRMWPatNoOffset; - - defm : TerRMWPatImmOff; - defm : TerRMWPatImmOff; - defm : TerRMWPatImmOff; - defm : TerRMWPatImmOff; - - defm : TerRMWPatOffsetOnly; - defm : TerRMWPatOffsetOnly; - - defm : TerRMWPatGlobalAddrOffOnly; - defm : TerRMWPatGlobalAddrOffOnly; -} - -defm : TerRMWPattern; +defm : TerRMWPat; +defm : TerRMWPat; // Truncating & zero-extending ternary RMW patterns. // DAG legalization & optimization before instruction selection may introduce @@ -862,75 +523,13 @@ class sext_ter_rmw_16_64 : sext_ter_rmw_8_64; // 32->64 sext RMW gets selected as i32.atomic.rmw.***, i64.extend_i32_s -// Patterns for various addressing modes for truncating-extending ternary RMWs. -multiclass TerRMWTruncExtPattern< - PatFrag rmw_8, PatFrag rmw_16, PatFrag rmw_32, - string inst8_32, string inst16_32, string inst8_64, string inst16_64, - string inst32_64> { - // Truncating-extending ternary RMWs with no constant offset - defm : TerRMWPatNoOffset, inst8_32>; - defm : TerRMWPatNoOffset, inst16_32>; - defm : TerRMWPatNoOffset, inst8_64>; - defm : TerRMWPatNoOffset, inst16_64>; - defm : TerRMWPatNoOffset, inst32_64>; - - defm : TerRMWPatNoOffset, inst8_32>; - defm : TerRMWPatNoOffset, inst16_32>; - defm : TerRMWPatNoOffset, inst8_64>; - defm : TerRMWPatNoOffset, inst16_64>; - - // Truncating-extending ternary RMWs with a constant offset - defm : TerRMWPatImmOff, regPlusImm, inst8_32>; - defm : TerRMWPatImmOff, regPlusImm, - inst16_32>; - defm : TerRMWPatImmOff, regPlusImm, inst8_64>; - defm : TerRMWPatImmOff, regPlusImm, - inst16_64>; - defm : TerRMWPatImmOff, regPlusImm, - inst32_64>; - defm : TerRMWPatImmOff, or_is_add, inst8_32>; - defm : TerRMWPatImmOff, or_is_add, inst16_32>; - defm : TerRMWPatImmOff, or_is_add, inst8_64>; - defm : TerRMWPatImmOff, or_is_add, inst16_64>; - defm : TerRMWPatImmOff, or_is_add, inst32_64>; - - defm : TerRMWPatImmOff, regPlusImm, inst8_32>; - defm : TerRMWPatImmOff, regPlusImm, - inst16_32>; - defm : TerRMWPatImmOff, regPlusImm, inst8_64>; - defm : TerRMWPatImmOff, regPlusImm, - inst16_64>; - defm : TerRMWPatImmOff, or_is_add, inst8_32>; - defm : TerRMWPatImmOff, or_is_add, inst16_32>; - defm : TerRMWPatImmOff, or_is_add, inst8_64>; - defm : TerRMWPatImmOff, or_is_add, inst16_64>; - - // Truncating-extending ternary RMWs with just a constant offset - defm : TerRMWPatOffsetOnly, inst8_32>; - defm : TerRMWPatOffsetOnly, inst16_32>; - defm : TerRMWPatOffsetOnly, inst8_64>; - defm : TerRMWPatOffsetOnly, inst16_64>; - defm : TerRMWPatOffsetOnly, inst32_64>; - - defm : TerRMWPatOffsetOnly, inst8_32>; - defm : TerRMWPatOffsetOnly, inst16_32>; - defm : TerRMWPatOffsetOnly, inst8_64>; - defm : TerRMWPatOffsetOnly, inst16_64>; - - defm : TerRMWPatGlobalAddrOffOnly, inst8_32>; - defm : TerRMWPatGlobalAddrOffOnly, inst16_32>; - defm : TerRMWPatGlobalAddrOffOnly, inst8_64>; - defm : TerRMWPatGlobalAddrOffOnly, inst16_64>; - defm : TerRMWPatGlobalAddrOffOnly, inst32_64>; - - defm : TerRMWPatGlobalAddrOffOnly, inst8_32>; - defm : TerRMWPatGlobalAddrOffOnly, inst16_32>; - defm : TerRMWPatGlobalAddrOffOnly, inst8_64>; - defm : TerRMWPatGlobalAddrOffOnly, inst16_64>; -} +defm : TerRMWPat, "ATOMIC_RMW8_U_CMPXCHG_I32">; +defm : TerRMWPat, "ATOMIC_RMW16_U_CMPXCHG_I32">; +defm : TerRMWPat, "ATOMIC_RMW8_U_CMPXCHG_I64">; +defm : TerRMWPat, "ATOMIC_RMW16_U_CMPXCHG_I64">; +defm : TerRMWPat, "ATOMIC_RMW32_U_CMPXCHG_I64">; -defm : TerRMWTruncExtPattern< - atomic_cmp_swap_8, atomic_cmp_swap_16, atomic_cmp_swap_32, - "ATOMIC_RMW8_U_CMPXCHG_I32", "ATOMIC_RMW16_U_CMPXCHG_I32", - "ATOMIC_RMW8_U_CMPXCHG_I64", "ATOMIC_RMW16_U_CMPXCHG_I64", - "ATOMIC_RMW32_U_CMPXCHG_I64">; +defm : TerRMWPat, "ATOMIC_RMW8_U_CMPXCHG_I32">; +defm : TerRMWPat, "ATOMIC_RMW16_U_CMPXCHG_I32">; +defm : TerRMWPat, "ATOMIC_RMW8_U_CMPXCHG_I64">; +defm : TerRMWPat, "ATOMIC_RMW16_U_CMPXCHG_I64">;