[pypy-svn] r29428 - in pypy/dist/pypy/translator/cli: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Jun 28 13:30:56 CEST 2006
Author: arigo
Date: Wed Jun 28 13:30:52 2006
New Revision: 29428
Modified:
pypy/dist/pypy/translator/cli/opcodes.py
pypy/dist/pypy/translator/cli/test/test_op.py
Log:
Fix int_is_true(). Also, used cgt.un instead of ceq because it avoids
the Not.
Modified: pypy/dist/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/dist/pypy/translator/cli/opcodes.py (original)
+++ pypy/dist/pypy/translator/cli/opcodes.py Wed Jun 28 13:30:52 2006
@@ -72,7 +72,7 @@
'unichar_eq': 'ceq',
'unichar_ne': _not('ceq'),
- 'int_is_true': DoNothing,
+ 'int_is_true': [PushAllArgs, 'ldc.i4.0', 'cgt.un'],
'int_neg': 'neg',
'int_neg_ovf': _check(['ldc.i4.0', PushAllArgs, 'sub.ovf', StoreResult]),
'int_abs': _abs('int32'),
@@ -118,7 +118,7 @@
'int_floordiv_ovf_zer': None, # what's the meaning?
'int_mod_ovf_zer': None,
- 'uint_is_true': DoNothing,
+ 'uint_is_true': [PushAllArgs, 'ldc.i4.0', 'cgt.un'],
'uint_neg': None, # What's the meaning?
'uint_abs': _abs('unsigned int32'), # TODO: ?
'uint_invert': 'not',
@@ -160,7 +160,7 @@
'float_floor': None, # TODO
'float_fmod': None, # TODO
- 'llong_is_true': [PushAllArgs, 'ldc.i8 0', 'ceq']+Not,
+ 'llong_is_true': [PushAllArgs, 'ldc.i8 0', 'cgt.un'],
'llong_neg': 'neg',
'llong_abs': _abs('int64'),
'llong_invert': 'not',
@@ -179,7 +179,7 @@
'llong_gt': 'cgt',
'llong_ge': _not('clt'),
- 'ullong_is_true': [PushAllArgs, 'ldc.i8 0', 'ceq']+Not,
+ 'ullong_is_true': [PushAllArgs, 'ldc.i8 0', 'cgt.un'],
'ullong_neg': None,
'ullong_abs': _abs('unsigned int64'),
'ullong_invert': 'not',
Modified: pypy/dist/pypy/translator/cli/test/test_op.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_op.py (original)
+++ pypy/dist/pypy/translator/cli/test/test_op.py Wed Jun 28 13:30:52 2006
@@ -83,11 +83,5 @@
def op_any_abs(x, y):
return abs(x)
-
-def test_int_is_true():
- def f(x):
- return bool(x)
- check(f, [int], [0])
- check(f, [int], [-1])
- import py; py.test.skip("XXX the following test fails")
- check(f, [int], [256])
+def op_any_is_true(x, y):
+ return bool(x)
More information about the Pypy-commit
mailing list