1//===-- M68kInstrAtomics.td - Atomics Instructions ---------*- tablegen -*-===// 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 9foreach size = [8, 16, 32] in { 10 def : Pat<(!cast<SDPatternOperator>("atomic_load_"#size) MxCP_ARI:$ptr), 11 (!cast<MxInst>("MOV"#size#"dj") !cast<MxMemOp>("MxARI"#size):$ptr)>; 12 13 def : Pat<(!cast<SDPatternOperator>("atomic_store_"#size) MxCP_ARI:$ptr, 14 !cast<MxRegOp>("MxDRD"#size):$val), 15 (!cast<MxInst>("MOV"#size#"jd") !cast<MxMemOp>("MxARI"#size):$ptr, 16 !cast<MxRegOp>("MxDRD"#size):$val)>; 17} 18 19let Predicates = [AtLeastM68020] in { 20class MxCASOp<bits<2> size_encoding, MxType type> 21 : MxInst<(outs type.ROp:$out), 22 (ins type.ROp:$dc, type.ROp:$du, !cast<MxMemOp>("MxARI"#type.Size):$mem), 23 "cas."#type.Prefix#" $dc, $du, $mem"> { 24 let Inst = (ascend 25 (descend 0b00001, size_encoding, 0b011, MxEncAddrMode_j<"mem">.EA), 26 (descend 0b0000000, (operand "$du", 3), 0b000, (operand "$dc", 3)) 27 ); 28 let Constraints = "$out = $dc"; 29 let mayLoad = 1; 30 let mayStore = 1; 31} 32 33def CAS8 : MxCASOp<0x1, MxType8d>; 34def CAS16 : MxCASOp<0x2, MxType16d>; 35def CAS32 : MxCASOp<0x3, MxType32d>; 36 37 38foreach size = [8, 16, 32] in { 39 def : Pat<(!cast<SDPatternOperator>("atomic_cmp_swap_"#size) MxCP_ARI:$ptr, 40 !cast<MxRegOp>("MxDRD"#size):$cmp, 41 !cast<MxRegOp>("MxDRD"#size):$new), 42 (!cast<MxInst>("CAS"#size) !cast<MxRegOp>("MxDRD"#size):$cmp, 43 !cast<MxRegOp>("MxDRD"#size):$new, 44 !cast<MxMemOp>("MxARI"#size):$ptr)>; 45} 46} // let Predicates = [AtLeastM68020] 47