[pypy-commit] pypy libgccjit-backend: Support more of test_int_operations (requires gcc_jit_context_new_rvalue_from_long)

dmalcolm noreply at buildbot.pypy.org
Wed Dec 17 17:48:40 CET 2014


Author: David Malcolm <dmalcolm at redhat.com>
Branch: libgccjit-backend
Changeset: r74985:478e510f4673
Date: 2014-12-17 01:36 -0500
http://bitbucket.org/pypy/pypy/changeset/478e510f4673/

Log:	Support more of test_int_operations (requires
	gcc_jit_context_new_rvalue_from_long)

diff --git a/rpython/jit/backend/libgccjit/assembler.py b/rpython/jit/backend/libgccjit/assembler.py
--- a/rpython/jit/backend/libgccjit/assembler.py
+++ b/rpython/jit/backend/libgccjit/assembler.py
@@ -248,8 +248,8 @@
         elif isinstance(expr, ConstInt):
             #print('value: %r' % expr.value)
             #print('type(value): %r' % type(expr.value))
-            return self.ctxt.new_rvalue_from_int(self.t_Signed,
-                                                 r_int(expr.value))
+            return self.ctxt.new_rvalue_from_long(self.t_Signed,
+                                                  r_long(expr.value))
         raise ValueError('unhandled expr: %s' % expr)
 
     def get_box_as_lvalue(self, box):
@@ -299,6 +299,24 @@
     def emit_int_floordiv(self, resop):
         self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_DIVIDE)
 
+    def emit_int_mod(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_MODULO)
+
+    def emit_int_and(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_BITWISE_AND)
+
+    def emit_int_or(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_BITWISE_OR)
+
+    def emit_int_xor(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_BITWISE_XOR)
+
+    def emit_int_rshift(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_RSHIFT)
+
+    def emit_int_lshift(self, resop):
+        self.impl_int_binop(resop, self.lib.GCC_JIT_BINARY_OP_LSHIFT)
+
     def emit_label(self, resop):
         print(resop)
         print(resop.__dict__)
diff --git a/rpython/jit/backend/libgccjit/rffi_bindings.py b/rpython/jit/backend/libgccjit/rffi_bindings.py
--- a/rpython/jit/backend/libgccjit/rffi_bindings.py
+++ b/rpython/jit/backend/libgccjit/rffi_bindings.py
@@ -129,6 +129,11 @@
                                               INT]),
 
                 (self.GCC_JIT_TYPE_P,
+                 'gcc_jit_context_get_int_type', [self.GCC_JIT_CONTEXT_P,
+                                                  INT,
+                                                  INT]),
+
+                (self.GCC_JIT_TYPE_P,
                  'gcc_jit_type_get_pointer', [self.GCC_JIT_TYPE_P]),
 
                 (self.GCC_JIT_FIELD_P,
@@ -200,6 +205,10 @@
                                                          self.GCC_JIT_TYPE_P,
                                                          INT]),
                 (self.GCC_JIT_RVALUE_P,
+                 'gcc_jit_context_new_rvalue_from_long', [self.GCC_JIT_CONTEXT_P,
+                                                          self.GCC_JIT_TYPE_P,
+                                                          LONG]),
+                (self.GCC_JIT_RVALUE_P,
                  'gcc_jit_context_zero', [self.GCC_JIT_CONTEXT_P,
                                           self.GCC_JIT_TYPE_P]),
                 (self.GCC_JIT_RVALUE_P,
@@ -396,6 +405,12 @@
                     self.lib.gcc_jit_context_get_type(self.inner_ctxt,
                                                       r_enum))
 
+    def get_int_type(self, num_bytes, is_signed):
+        return Type(self.lib,
+                    self.lib.gcc_jit_context_get_int_type(self.inner_ctxt,
+                                                          num_bytes,
+                                                          is_signed))
+
     def new_field(self, type_, name):
         name_charp = str2charp(name)
         field = self.lib.gcc_jit_context_new_field(self.inner_ctxt,
@@ -437,6 +452,12 @@
                                                                    type_.inner_type,
                                                                    llvalue))
 
+    def new_rvalue_from_long(self, type_, llvalue):
+        return RValue(self.lib,
+                      self.lib.gcc_jit_context_new_rvalue_from_long(self.inner_ctxt,
+                                                                    type_.inner_type,
+                                                                    llvalue))
+
     def new_rvalue_from_ptr(self, type_, llvalue):
         return RValue(self.lib,
                       self.lib.gcc_jit_context_new_rvalue_from_ptr(self.inner_ctxt,


More information about the pypy-commit mailing list