LDAXR

Loads and stores

fixed bit field field the encoding fixes should be

Memory exclusive single

313029282726252423222120191817161514131211109876543210
1x00100001011111111111RnRt
sizeLRso0Rt2

1x00100001011111111111xxxxxxxxxx

Decode Sail

let 'n = UInt(Rn);
let 't = UInt(Rt);
let 't2 = UInt(Rt2);
let 's = UInt(Rs);
let acqrel : bool = o0 == 0b1;
let pair : bool = false;
let memop : MemOp = if L == 0b1 then MemOp_LOAD else MemOp_STORE;
let 'elsize = (8 << UInt(size));
let 'regsize = if elsize == 64 then 64 else 32;
let 'datasize = if pair then elsize * 2 else elsize;
let tagchecked : bool = n != 31;
rt_unknown : bool = false;
rn_unknown : bool = false;
if (memop == MemOp_LOAD & pair) & t == t2 then {
    let c : Constraint = ConstrainUnpredictable(Unpredictable_LDPOVERLAP);
    assert(c == Constraint_UNKNOWN | c == Constraint_UNDEF | c == Constraint_NOP);
    match c {
      Constraint_UNKNOWN => {
          rt_unknown = true
      },
      Constraint_UNDEF => {
          throw(Error_Undefined())
      },
      Constraint_NOP => {
          EndOfInstruction()
      },
      _ => ()
    }
};
if memop == MemOp_STORE then {
    if s == t | pair & s == t2 then {
        let c : Constraint = ConstrainUnpredictable(Unpredictable_DATAOVERLAP);
        assert(c == Constraint_UNKNOWN | c == Constraint_UNDEF | c == Constraint_NOP);
        match c {
          Constraint_UNKNOWN => {
              rt_unknown = true
          },
          Constraint_UNDEF => {
              throw(Error_Undefined())
          },
          Constraint_NOP => {
              EndOfInstruction()
          },
          _ => ()
        }
    };
    if s == n & n != 31 then {
        let c : Constraint = ConstrainUnpredictable(Unpredictable_BASEOVERLAP);
        assert(c == Constraint_UNKNOWN | c == Constraint_UNDEF | c == Constraint_NOP);
        match c {
          Constraint_UNKNOWN => {
              rn_unknown = true
          },
          Constraint_UNDEF => {
              throw(Error_Undefined())
          },
          Constraint_NOP => {
              EndOfInstruction()
          },
          _ => ()
        }
    };
    ()
};
execute_aarch64_instrs_memory_exclusive_single(acqrel, datasize, elsize, memop, n, pair, regsize, rn_unknown, rt_unknown, s, t, t2, tagchecked)

Operation Sail

address : bits(64) = undefined;
data : bits('datasize) = undefined;
let 'dbytes = DIV(datasize, 8);
let accdesc : AccessDescriptor = CreateAccDescExLDST(memop, acqrel, tagchecked);
if n == 31 then {
    CheckSPAlignment();
    address = SP_read()
} else if rn_unknown then {
    address = __UNKNOWN_bits(64)
} else {
    address = X_read(n, 64)
};
match memop {
  MemOp_STORE => {
      if rt_unknown then {
          data = __UNKNOWN_bits(datasize)
      } else if pair then {
          assert(constraint((div('datasize, 2) == 8 | div('datasize, 2) == 16 | div('datasize, 2) == 32 | div('datasize, 2) == 64)));
          let el1 : bits(div('datasize, 2)) = X_read(t, DIV(datasize, 2));
          let el2 : bits(div('datasize, 2)) = X_read(t2, DIV(datasize, 2));
          data = if BigEndian(accdesc.acctype) then el1 @ el2 else el2 @ el1
      } else {
          assert(constraint('datasize in {8, 16, 32, 64}));
          data = X_read(t, datasize)
      };
      status : bits(1) = 0b1;
      if AArch64_ExclusiveMonitorsPass(address, dbytes) then {
          Mem_set(address, dbytes, accdesc) = data;
          status = ExclusiveMonitorsStatus()
      } else if SPESampleInFlight then {
          SPESetDataVirtualAddress(address)
      } else ();
      X_set(s, 32) = ZeroExtend(status, 32)
  },
  MemOp_LOAD => {
      AArch64_SetExclusiveMonitors(address, dbytes);
      if pair then {
          if rt_unknown then {
              assert(constraint('datasize in {32, 64}));
              X_set(t, datasize) = __UNKNOWN_bits(datasize)
          } else if elsize == 32 then {
              let data : bits('datasize) = Mem_read(address, dbytes, accdesc);
              if BigEndian(accdesc.acctype) then {
                  assert(constraint((0 <= 'elsize & 'elsize <= 'datasize - 1 & 'datasize - 1 < 'datasize)));
                  assert(constraint(('datasize - 'elsize == 32 | 'datasize - 'elsize == 64)));
                  X_set(t, datasize - elsize) = data[datasize - 1 .. elsize];
                  X_set(t2, elsize) = data[elsize - 1 .. 0]
              } else {
                  assert(constraint((0 <= 'elsize - 1 & 'elsize - 1 < 'datasize)));
                  X_set(t, elsize) = data[elsize - 1 .. 0];
                  assert(constraint((0 <= 'elsize & 'elsize <= 'datasize - 1 & 'datasize - 1 < 'datasize)));
                  assert(constraint(('datasize - 'elsize == 32 | 'datasize - 'elsize == 64)));
                  X_set(t2, datasize - elsize) = data[datasize - 1 .. elsize]
              }
          } else {
              if not_bool(IsAligned__1(address, dbytes)) then {
                  AArch64_Abort(address, AlignmentFault(accdesc))
              };
              X_set(t, 64) = Mem_read(address + 0, 8, accdesc);
              X_set(t2, 64) = Mem_read(address + 8, 8, accdesc)
          }
      } else {
          let data : bits('datasize) = Mem_read(address, dbytes, accdesc);
          assert(constraint(('datasize >= 0 & 'regsize >= 'datasize)));
          X_set(t, regsize) = ZeroExtend(data, regsize)
      }
  },
  _ => ()
};
if SPESampleInFlight then {
    let ar : bits(1) = if acqrel then 0b1 else 0b0;
    let excl : bits(1) = 0b1;
    let at : bits(1) = 0b0;
    let is_load : bool = memop == MemOp_LOAD;
    SPESampleExtendedLoadStore(ar, excl, at, is_load)
};
()

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.