cmpxchg Operation Font Conventions
if (PR[qp]) {
check_target_register
;

if (GR[r3].nat || GR[r2].nat)
register_nat_consumption_fault(SEMAPHORE);

paddr = tlb_translate(GR[r3], sz, SEMAPHORE, PSR.cpl, &mattr, &tmp_unused);

if (!ma_supports_semaphores(mattr))
unsupported_data_reference_fault(GR[r3]);

if (sem == ‘acq') {
val = mem_xchg_cond(AR[CCV], GR[r2], paddr, sz, UM.be, mattr, ACQUIRE,
ldhint
);
} else { // ‘rel'
val = mem_xchg_cond(AR[CCV], GR[r2], paddr, sz, UM.be, mattr, RELEASE,
ldhint
);
}
val = zero_ext(val, sz * 8);

if (AR[CCV] == val)
alat_inval_multiple_entries
(paddr, sz);

GR[r1] = val;
GR[r1].nat = 0;
}