From d48f8730ae7334364c34d2c3ca3d55aa55a7934a Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 7 Sep 2023 23:02:57 +0300 Subject: [PATCH] libsvp64: support non-zero operands --- src/libsvp64/codegen.py | 4 ++++ src/libsvp64/svp64.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/libsvp64/codegen.py b/src/libsvp64/codegen.py index f6d16307..748796c5 100644 --- a/src/libsvp64/codegen.py +++ b/src/libsvp64/codegen.py @@ -282,6 +282,9 @@ class DisGenSource(Source): yield f"flags = {flags};" self.emit("break;") + def nonzero_handler(span): + yield from generic_handler(span, "SVP64_OPERAND_NONZERO") + def signed_handler(span): mask = f"(UINT32_C(1) << (UINT32_C({len(span)}) - 1))" yield "value = (" @@ -327,6 +330,7 @@ class DisGenSource(Source): insndb.CR3Operand: cr3_handler, insndb.CR5Operand: cr5_handler, insndb.SignedOperand: signed_handler, + insndb.NonZeroOperand: nonzero_handler, insndb.DynamicOperand: generic_handler, object: None, } diff --git a/src/libsvp64/svp64.h b/src/libsvp64/svp64.h index c45a7e54..d0907a08 100644 --- a/src/libsvp64/svp64.h +++ b/src/libsvp64/svp64.h @@ -38,6 +38,7 @@ struct svp64_operand { #define SVP64_OPERAND_PAIR (UINT32_C(1) << UINT32_C(3)) #define SVP64_OPERAND_CR3 (UINT32_C(1) << UINT32_C(4)) #define SVP64_OPERAND_CR5 (UINT32_C(1) << UINT32_C(5)) +#define SVP64_OPERAND_NONZERO (UINT32_C(1) << UINT32_C(6)) struct svp64_ctx { struct svp64_record const *record; -- 2.30.2