[pypy-svn] r48123 - in pypy/dist/pypy/translator/llvm: . test
rxe at codespeak.net
rxe at codespeak.net
Sun Oct 28 02:46:49 CEST 2007
Author: rxe
Date: Sun Oct 28 02:46:49 2007
New Revision: 48123
Modified:
pypy/dist/pypy/translator/llvm/buildllvm.py
pypy/dist/pypy/translator/llvm/test/test_lltype.py
Log:
support for getting longlong/ulonglong ints from tests
Modified: pypy/dist/pypy/translator/llvm/buildllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/buildllvm.py (original)
+++ pypy/dist/pypy/translator/llvm/buildllvm.py Sun Oct 28 02:46:49 2007
@@ -57,7 +57,9 @@
lltype.Float: "ctypes.c_double",
lltype.Char: "ctypes.c_char",
lltype.Signed: "ctypes.c_int",
- lltype.Unsigned: "ctypes.c_uint"
+ lltype.Unsigned: "ctypes.c_uint",
+ lltype.SignedLongLong: "ctypes.c_longlong",
+ lltype.UnsignedLongLong: "ctypes.c_ulonglong"
}
name = genllvm.entrynode.ref.strip("%")
@@ -162,7 +164,7 @@
def cmds_objects(self, base):
# XXX why this hack???
- use_gcc = True #self.genllvm.config.translation.llvm_via_c
+ use_gcc = False #self.genllvm.config.translation.llvm_via_c
if use_gcc:
self.cmds.append("llc %s.bc -march=c -f -o %s.c" % (base, base))
self.cmds.append("gcc %s.c -c -O3 -fomit-frame-pointer" % base)
Modified: pypy/dist/pypy/translator/llvm/test/test_lltype.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_lltype.py (original)
+++ pypy/dist/pypy/translator/llvm/test/test_lltype.py Sun Oct 28 02:46:49 2007
@@ -729,6 +729,19 @@
fn = compile_function(llf, [])
fn()
+def test_longlongs():
+ def llf(n):
+ return r_longlong(n) * r_longlong(2**32)
+ fn = compile_function(llf, [int])
+ assert fn(0) == 0
+ assert fn(42) == 42 * 2**32
+ assert fn(-42) == -42 * 2**32
+ def llf(n):
+ return r_ulonglong(n) * r_ulonglong(2**32)
+ fn = compile_function(llf, [int])
+ assert fn(0) == 0
+ assert fn(42) == 42 * 2**32
+
class TestLowLevelType(object):
def getcompiled(self, f, args=[]):
return compile_function(f, args)
More information about the Pypy-commit
mailing list