guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 16/17: Add fixnum fast-path for =


From: Andy Wingo
Subject: [Guile-commits] 16/17: Add fixnum fast-path for =
Date: Wed, 11 Dec 2019 03:47:52 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit 5e41d58ab93d07505dded3bf7b4e068b6d8120a9
Author: Andy Wingo <address@hidden>
Date:   Tue Dec 10 22:54:17 2019 +0100

    Add fixnum fast-path for =
    
    * libguile/jit.c (compile_numerically_equal): Add fixnum fast-path.
      (compile_numerically_equal_slow): New slow path.
---
 libguile/jit.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/libguile/jit.c b/libguile/jit.c
index 6f2d411..06c1d21 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -3920,9 +3920,35 @@ compile_numerically_equal (scm_jit_state *j, uint16_t a, 
uint16_t b)
   jit_reloc_t k;
   uint32_t *target;
 
-  emit_store_current_ip (j, T0);
+  emit_sp_ref_scm (j, T0, a);
+  emit_sp_ref_scm (j, T1, b);
+
+  emit_andr (j, T2, T0, T1);
+  add_slow_path_patch (j, jit_bmci (j->jit, T2, scm_tc2_int));
+
+  switch (fuse_conditional_branch (j, &target))
+    {
+    case scm_op_je:
+      k = jit_beqr (j->jit, T0, T1);
+      break;
+    case scm_op_jne:
+      k = jit_bner (j->jit, T0, T1);
+      break;
+    default:
+      UNREACHABLE ();
+    }
+  add_inter_instruction_patch (j, k, target);
+}
+static void
+compile_numerically_equal_slow (scm_jit_state *j, uint16_t a, uint16_t b)
+{
+  jit_reloc_t k;
+  uint32_t *target;
+
+  emit_store_current_ip (j, T2);
   emit_call_2 (j, scm_vm_intrinsics.numerically_equal_p,
-               sp_scm_operand (j, a), sp_scm_operand (j, b));
+               jit_operand_gpr (JIT_OPERAND_ABI_WORD, T0),
+               jit_operand_gpr (JIT_OPERAND_ABI_WORD, T1));
   emit_retval (j, T0);
   emit_reload_sp (j);
   switch (fuse_conditional_branch (j, &target))
@@ -3937,10 +3963,7 @@ compile_numerically_equal (scm_jit_state *j, uint16_t a, 
uint16_t b)
       UNREACHABLE ();
     }
   add_inter_instruction_patch (j, k, target);
-}
-static void
-compile_numerically_equal_slow (scm_jit_state *j, uint16_t a, uint16_t b)
-{
+  continue_after_slow_path (j, j->next_ip);
 }
 
 static void



reply via email to

[Prev in Thread] Current Thread [Next in Thread]