[pypy-commit] pypy default: Fix

arigo pypy.commits at gmail.com
Sun Jun 26 16:21:06 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r85387:99ea9c77a44c
Date: 2016-06-26 20:10 +0100
http://bitbucket.org/pypy/pypy/changeset/99ea9c77a44c/

Log:	Fix

diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -319,8 +319,8 @@
     'lllong_rshift':         LLOp(canfold=True),  # args (r_longlonglong, int)
     'lllong_xor':            LLOp(canfold=True),
 
-    'long2_floordiv':       LLOp(canfold=True),  # (double-r_long, int) => int
-                                                 # (all integers signed)
+    'long2_floordiv':       LLOp(canfold=True),  # r = x / y: r and y Signed,
+                                                 # x can have 2x the size
 
     'cast_primitive':       LLOp(canfold=True),
     'cast_bool_to_int':     LLOp(canfold=True),
diff --git a/rpython/translator/c/src/asm_gcc_x86.h b/rpython/translator/c/src/asm_gcc_x86.h
--- a/rpython/translator/c/src/asm_gcc_x86.h
+++ b/rpython/translator/c/src/asm_gcc_x86.h
@@ -111,6 +111,8 @@
 #undef OP_LONG2_FLOORDIV
 /* assumes that 'y' and 'r' fit in a signed word, 
    but 'x' takes up to two words */
-#define OP_LONG2_FLOORDIV(x, y, r)                              \
-    __asm__("idiv %1" : "=a"(r) :                               \
-            "r"((long)y), "A"((long long)x));
+#define OP_LONG2_FLOORDIV(x, y, r)   do {               \
+        long ignored;                                   \
+        __asm__("idiv %2" : "=a"(r), "=d"(ignored) :    \
+                "r"((long)y), "A"((long long)x));       \
+    } while (0)
diff --git a/rpython/translator/c/src/asm_gcc_x86_64.h b/rpython/translator/c/src/asm_gcc_x86_64.h
--- a/rpython/translator/c/src/asm_gcc_x86_64.h
+++ b/rpython/translator/c/src/asm_gcc_x86_64.h
@@ -10,6 +10,9 @@
 #undef OP_LONG2_FLOORDIV
 /* assumes that 'y' and 'r' fit in a signed word, 
    but 'x' takes up to two words */
-#define OP_LONG2_FLOORDIV(x, y, r)                              \
-    __asm__("idiv %1" : "=a"(r) :                               \
-            "r"((long)y), "a"((long)x), "d"((long)((x >> 32) >> 32)))
+#define OP_LONG2_FLOORDIV(x, y, r)    do {                      \
+        long ignored;                                           \
+        __asm__("idiv %2" : "=a"(r), "=d"(ignored) :            \
+                "r"((long)y), "a"((long)x),                     \
+                "d"((long)((x >> 32) >> 32)));                  \
+    } while (0)


More information about the pypy-commit mailing list