[pypy-commit] pypy ppc-vsx-support: prevent overflow during test which would make the result not equal (python does not wrap around)

plan_rich pypy.commits at gmail.com
Thu Nov 3 04:30:31 EDT 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: ppc-vsx-support
Changeset: r88095:dbe73c37fc59
Date: 2016-11-03 09:29 +0100
http://bitbucket.org/pypy/pypy/changeset/dbe73c37fc59/

Log:	prevent overflow during test which would make the result not equal
	(python does not wrap around)

diff --git a/rpython/jit/metainterp/test/test_vector.py b/rpython/jit/metainterp/test/test_vector.py
--- a/rpython/jit/metainterp/test/test_vector.py
+++ b/rpython/jit/metainterp/test/test_vector.py
@@ -236,14 +236,14 @@
     vec_int_arith = functools.partial(vec_int_arith, _vector_simple_int)
 
     test_vec_signed_add = \
-        vec_int_arith(lambda a,b: intmask(a+b), rffi.SIGNED)
+        vec_int_arith(lambda a,b: intmask(intmask(a)+intmask(b)), rffi.SIGNED)
     test_vec_int_add = \
         vec_int_arith(lambda a,b: r_int(a)+r_int(b), rffi.INT)
     test_vec_short_add = \
         vec_int_arith(lambda a,b: r_int(a)+r_int(b), rffi.SHORT)
 
-    test_vec_sub_signed = \
-        vec_int_arith(lambda a,b: intmask(a-b), rffi.SIGNED)
+    test_vec_signed_sub = \
+        vec_int_arith(lambda a,b: intmask(intmask(a)-intmask(b)), rffi.SIGNED)
     test_vec_sub_int = \
         vec_int_arith(lambda a,b: r_int(a)-r_int(b), rffi.INT)
     test_vec_sub_short = \


More information about the pypy-commit mailing list