Author: Armin Rigo <[email protected]>
Branch:
Changeset: r79879:17cf8dc91402
Date: 2015-09-28 12:25 +0200
http://bitbucket.org/pypy/pypy/changeset/17cf8dc91402/
Log: Marginal improvement
diff --git a/rpython/jit/backend/x86/assembler.py
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -1073,7 +1073,6 @@
genop_nursery_ptr_increment = _binaryop_or_lea('ADD', is_add=True)
genop_int_sub = _binaryop_or_lea("SUB", is_add=False)
genop_int_mul = _binaryop("IMUL")
- genop_int_and = _binaryop("AND")
genop_int_or = _binaryop("OR")
genop_int_xor = _binaryop("XOR")
genop_int_lshift = _binaryop("SHL")
@@ -1084,6 +1083,15 @@
genop_float_mul = _binaryop('MULSD')
genop_float_truediv = _binaryop('DIVSD')
+ def genop_int_and(self, op, arglocs, result_loc):
+ arg1 = arglocs[1]
+ if IS_X86_64 and (isinstance(arg1, ImmedLoc) and
+ arg1.value == (1 << 32) - 1):
+ # special case
+ self.mc.MOV32(arglocs[0], arglocs[0])
+ else:
+ self.mc.AND(arglocs[0], arg1)
+
genop_int_lt = _cmpop("L", "G")
genop_int_le = _cmpop("LE", "GE")
genop_int_eq = _cmpop("E", "E")
diff --git a/rpython/jit/backend/x86/test/test_runner.py
b/rpython/jit/backend/x86/test/test_runner.py
--- a/rpython/jit/backend/x86/test/test_runner.py
+++ b/rpython/jit/backend/x86/test/test_runner.py
@@ -272,6 +272,17 @@
'void', ofsi)
assert p.i == 3**33
+ def test_and_mask_common_patterns(self):
+ cases = [8, 16, 24]
+ if WORD == 8:
+ cases.append(32)
+ for i in cases:
+ box = InputArgInt(0xAAAAAAAAAAAA)
+ res = self.execute_operation(rop.INT_AND,
+ [box, ConstInt(2 ** i - 1)],
+ 'int')
+ assert res == 0xAAAAAAAAAAAA & (2 ** i - 1)
+
def test_nullity_with_guard(self):
allops = [rop.INT_IS_TRUE]
guards = [rop.GUARD_TRUE, rop.GUARD_FALSE]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit