Commit b4a62341 authored by Armin Rigo's avatar Armin Rigo
Browse files

Make the usage of INT_TEST_xxx conditional on the backend

--HG--
branch : int-test-is-zero
parent 092643ba66ac
......@@ -333,6 +333,7 @@ class LLGraphCPU(model.AbstractCPU):
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):
......
......@@ -20,6 +20,7 @@ class AbstractCPU(object):
supports_singlefloats = False
supports_guard_gc_type = False
supports_load_effective_address = False
supports_int_test_instructions = False
propagate_exception_descr = None
......
......@@ -17,6 +17,7 @@ class AbstractX86CPU(AbstractLLCPU):
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
......
......@@ -646,15 +646,16 @@ class OptRewrite(Optimization):
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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment