[pypy-svn] r26167 - in pypy/dist/pypy/translator: . test tool
yusei at codespeak.net
yusei at codespeak.net
Sun Apr 23 09:18:02 CEST 2006
Author: yusei
Date: Sun Apr 23 09:17:16 2006
New Revision: 26167
Modified:
pypy/dist/pypy/translator/gencl.py
pypy/dist/pypy/translator/test/test_cltrans.py
pypy/dist/pypy/translator/tool/buildcl.py
Log:
(nik, yusei, george, niibe)
Enable the gcd test to pass.
Modified: pypy/dist/pypy/translator/gencl.py
==============================================================================
--- pypy/dist/pypy/translator/gencl.py (original)
+++ pypy/dist/pypy/translator/gencl.py Sun Apr 23 09:17:16 2006
@@ -34,6 +34,7 @@
"inplace_add": "+", # weird, but it works
"inplace_lshift": "ash",
"mod": "mod",
+ "int_mod": "mod",
"lt": "<",
"le": "<=",
"eq": "=",
@@ -81,18 +82,19 @@
self.gen.emit_typecase(table, arg1)
print "))"
- def op_is_true(self):
- s = self.str
- result, (arg1,) = self.result, self.args
- print "(setq", s(result)
+ def op_is_true(self, arg):
+ print "(setq", self.str(self.result)
table = {
(bool,): "%s",
(int,): "(not (zerop %s))",
(long,): "(not (zerop %s))",
(list,): "(not (zerop (length %s)))",
}
- self.gen.emit_typecase(table, arg1)
+ self.gen.emit_typecase(table, arg)
print ")"
+
+ def op_int_is_true(self):
+ self.op_is_true(self.args[0])
def op_newtuple(self):
s = self.str
Modified: pypy/dist/pypy/translator/test/test_cltrans.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_cltrans.py (original)
+++ pypy/dist/pypy/translator/test/test_cltrans.py Sun Apr 23 09:17:16 2006
@@ -55,7 +55,6 @@
assert cl_if([[]], 50, 100) == 50
def test_gcd(self):
- py.test.skip("temporarily disabled")
cl_gcd = make_cl_func(t.my_gcd, [int, int])
assert cl_gcd(96, 64) == 32
Modified: pypy/dist/pypy/translator/tool/buildcl.py
==============================================================================
--- pypy/dist/pypy/translator/tool/buildcl.py (original)
+++ pypy/dist/pypy/translator/tool/buildcl.py Sun Apr 23 09:17:16 2006
@@ -4,6 +4,7 @@
from pypy.translator.translator import TranslationContext
from pypy.translator.gencl import GenCL
from py.process import cmdexec
+from pypy import conftest
class Literal:
def __init__(self, val):
@@ -41,6 +42,10 @@
t = TranslationContext()
t.buildannotator().build_types(func, argtypes)
t.buildrtyper(type_system="ootype").specialize()
+
+ if conftest.option.view:
+ t.view()
+
graph = t.graphs[0]
gen = GenCL(graph, argtypes)
More information about the Pypy-commit
mailing list