On 10/30/2026 12:47 PM, Marco Liebel wrote:
On Thu, Oct 29, 2026 at 9:41 PM Brian Cain <[email protected]> wrote:
Implement an HMX accumulator clear instruction - mxclracc.

Signed-off-by: Brian Cain <[email protected]>
---
  target/hexagon/gen_tcg_hmx.h            | 13 +++++++++++++
  target/hexagon/helper.h                 |  2 ++
  target/hexagon/genptr.c                 |  1 +
  target/hexagon/op_helper.c              | 10 ++++++++++
  target/hexagon/translate.c              |  3 ++-
  target/hexagon/gen_idef_parser_funcs.py |  6 ++++++
  target/hexagon/hex_common.py            |  2 ++
  target/hexagon/meson.build              | 17 +++++++++--------
  8 files changed, 45 insertions(+), 9 deletions(-)
  create mode 100644 target/hexagon/gen_tcg_hmx.h

+void HELPER(mxclracc)(CPUHexagonState *env)
+{
+    HmxState *hmx = env->hmx_state;
+    int i;
+
+    for (i = 0; i < HMX_NUM_ACC_SETS; i++) {
+        memset(&hmx->acc[i].fxp_primary, 0, sizeof(hmx->acc[i].fxp_primary));
+    }
+}
The helper clears live state before packet commit. A store fault in the same
packet can leave the accumulators cleared without a commit.
It also dereferences hmx_state without checking that an HMX context exists.
env->hmx_state can be NULL here, because gen_start_packet() only checks
XE2.
Sent a v3 with fixes for these.

Reply via email to