Author: Armin Rigo <ar...@tunes.org>
Branch: int-test-is-zero
Changeset: r98065:56ea3adf27c4
Date: 2019-11-16 13:44 +0100
http://bitbucket.org/pypy/pypy/changeset/56ea3adf27c4/

Log:    Make the usage of INT_TEST_xxx conditional on the backend

diff --git a/rpython/jit/backend/llgraph/runner.py 
b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -333,6 +333,7 @@
     vector_ext.enable(16, accum=True)
     vector_ext.setup_once = lambda asm: asm
     load_supported_factors = (1,2,4,8)
+    supports_int_test_instructions = True
     assembler = None
 
     def __init__(self, rtyper, stats=None, *ignored_args, **kwds):
diff --git a/rpython/jit/backend/model.py b/rpython/jit/backend/model.py
--- a/rpython/jit/backend/model.py
+++ b/rpython/jit/backend/model.py
@@ -20,6 +20,7 @@
     supports_singlefloats = False
     supports_guard_gc_type = False
     supports_load_effective_address = False
+    supports_int_test_instructions = False
 
     propagate_exception_descr = None
 
diff --git a/rpython/jit/backend/x86/runner.py 
b/rpython/jit/backend/x86/runner.py
--- a/rpython/jit/backend/x86/runner.py
+++ b/rpython/jit/backend/x86/runner.py
@@ -17,6 +17,7 @@
     supports_floats = True
     supports_singlefloats = True
     supports_load_effective_address = True
+    supports_int_test_instructions = True
 
     dont_keepalive_stuff = False # for tests
     with_threads = False
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py 
b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -646,15 +646,16 @@
         elif info == INFO_NULL:
             self.make_constant_int(op, not expect_nonnull)
         else:
-            box = get_box_replacement(box)
-            box1 = self.optimizer.as_operation(box)
-            if box1 is not None and box1.getopnum() == rop.INT_AND:
-                if expect_nonnull:
-                    opnum = rop.INT_TEST_IS_TRUE
-                else:
-                    opnum = rop.INT_TEST_IS_ZERO
-                args = [box1.getarg(0), box1.getarg(1)]
-                op = self.replace_op_with(op, opnum, args=args)
+            if self.optimizer.cpu.supports_int_test_instructions:
+                box = get_box_replacement(box)
+                box1 = self.optimizer.as_operation(box)
+                if box1 is not None and box1.getopnum() == rop.INT_AND:
+                    if expect_nonnull:
+                        opnum = rop.INT_TEST_IS_TRUE
+                    else:
+                        opnum = rop.INT_TEST_IS_ZERO
+                    args = [box1.getarg(0), box1.getarg(1)]
+                    op = self.replace_op_with(op, opnum, args=args)
             return self.emit(op)
 
     def optimize_INT_IS_TRUE(self, op):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to