libsvp64: support address operands
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 7 Sep 2023 20:14:27 +0000 (23:14 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Thu, 7 Sep 2023 20:14:27 +0000 (23:14 +0300)
src/libsvp64/codegen.py
src/libsvp64/svp64.h

index 81008806d729c836c2529eb8f3d7fdcc71d36857..29d84daa45ee7c3f08a2cd6fdde53db6d9340ddf 100644 (file)
@@ -285,7 +285,7 @@ class DisGenSource(Source):
         def nonzero_handler(span):
             yield from generic_handler(span, "SVP64_OPERAND_NONZERO")
 
-        def signed_handler(span):
+        def signed_handler(span, flags="SVP64_OPERAND_SIGNED"):
             mask = f"(UINT32_C(1) << (UINT32_C({len(span)}) - 1))"
             yield "value = ("
             with self:
@@ -301,9 +301,12 @@ class DisGenSource(Source):
                 yield "-"
                 yield f"{mask}"
             yield ");"
-            yield "flags = SVP64_OPERAND_SIGNED;"
+            yield f"flags = {flags};"
             self.emit("break;")
 
+        def address_handler(span):
+            yield from signed_handler(span, "(SVP64_OPERAND_ADDRESS | SVP64_OPERAND_SIGNED)")
+
         def gpr_handler(span, pair=False):
             if not pair:
                 yield from generic_handler(span, "SVP64_OPERAND_GPR")
@@ -329,6 +332,7 @@ class DisGenSource(Source):
             insndb.GPROperand: fpr_handler,
             insndb.CR3Operand: cr3_handler,
             insndb.CR5Operand: cr5_handler,
+            insndb.TargetAddrOperand: address_handler,
             insndb.SignedOperand: signed_handler,
             insndb.NonZeroOperand: nonzero_handler,
             insndb.DynamicOperand: generic_handler,
index d0907a081334fa5fea7f01315ec4f3ec0834e908..e7f397ddcc5ef6fe84c56c3573eacd2a6a6fcd7d 100644 (file)
@@ -39,6 +39,7 @@ struct svp64_operand {
 #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))
+#define SVP64_OPERAND_ADDRESS   (UINT32_C(1) << UINT32_C(7))
 
 struct svp64_ctx {
     struct svp64_record const *record;