diff options
Diffstat (limited to 'rpython')
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/rewrite.py | 8 | ||||
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py | 22 |
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) |