AMOs should always return store faults, not load faults
[riscv-isa-sim.git] / riscv / insns / amomax_w.h
index 8c9222bc1b71af3d32eab643496187e395677380..757bdd2ccb7bdab94d6a3fade459acf17f66bd2d 100644 (file)
@@ -1,4 +1,2 @@
 require_extension('A');
-int32_t v = MMU.load_int32(RS1);
-MMU.store_uint32(RS1, std::max(int32_t(RS2),v));
-WRITE_RD(v);
+WRITE_RD(sext32(MMU.amo_uint32(RS1, [&](int32_t lhs) { return std::max(lhs, int32_t(RS2)); })));