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>
Sun, 10 Sep 2023 20:29:53 +0000 (23:29 +0300)
src/libsvp64/codegen.py
src/libsvp64/svp64.h

index 748796c597fc962e5ae5999aaa6a3aac859d73ae..01d6a1c541d7333321a1945bae7cd81c8143d508 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.FPROperand: 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;