aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-01-31 20:49:29 +0100
committerCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-01-31 20:49:29 +0100
commita2b56212fe2251ab804f2a820abf276594f040e9 (patch)
treecdebce58b917c1546ef22b37c830fb364e020b2c /rpython
parentonly unbox ints on 64 bit machines (otherwise there is no memory saving and (diff)
parentoptimize chains of longlong2float(float2longlong(x)) and vice versa (diff)
downloadpypy-a2b56212fe2251ab804f2a820abf276594f040e9.tar.gz
pypy-a2b56212fe2251ab804f2a820abf276594f040e9.tar.bz2
pypy-a2b56212fe2251ab804f2a820abf276594f040e9.zip
merge default
Diffstat (limited to 'rpython')
-rw-r--r--rpython/jit/metainterp/optimizeopt/rewrite.py8
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py22
2 files changed, 30 insertions, 0 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
index fc4cb8fa37..7024e51ad5 100644
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -917,6 +917,14 @@ class OptRewrite(Optimization):
self.optimizer.pure_from_args(rop.CAST_PTR_TO_INT, [op], op.getarg(0))
return self.emit(op)
+ def optimize_CONVERT_FLOAT_BYTES_TO_LONGLONG(self, op):
+ self.optimizer.pure_from_args(rop.CONVERT_LONGLONG_BYTES_TO_FLOAT, [op], op.getarg(0))
+ return self.emit(op)
+
+ def optimize_CONVERT_LONGLONG_BYTES_TO_FLOAT(self, op):
+ self.optimizer.pure_from_args(rop.CONVERT_FLOAT_BYTES_TO_LONGLONG, [op], op.getarg(0))
+ return self.emit(op)
+
def optimize_SAME_AS_I(self, op):
self.make_equal_to(op, op.getarg(0))
optimize_SAME_AS_R = optimize_SAME_AS_I
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
index 8f1ce2bfb0..4daf55065d 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -6303,3 +6303,25 @@ class TestOptimizeBasic(BaseTestBasic):
i57 = int_or(i51, i52)
"""
self.optimize_loop(ops, expected)
+
+ def test_convert_float_bytes_to_longlong(self):
+ ops = """
+ [f0, i0]
+ i1 = convert_float_bytes_to_longlong(f0)
+ f1 = convert_longlong_bytes_to_float(i1)
+ escape_f(f1)
+
+ f2 = convert_longlong_bytes_to_float(i0)
+ i2 = convert_float_bytes_to_longlong(f2)
+ escape_i(i2)
+ """
+
+ expected = """
+ [f0, i0]
+ i1 = convert_float_bytes_to_longlong(f0)
+ escape_f(f0)
+
+ f2 = convert_longlong_bytes_to_float(i0)
+ escape_i(i0)
+ """
+ self.optimize_loop(ops, expected)