[pypy-svn] r65684 - pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm

arigo at codespeak.net arigo at codespeak.net
Tue Jun 9 12:33:04 CEST 2009


Author: arigo
Date: Tue Jun  9 12:33:03 2009
New Revision: 65684

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/compile.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/runner.py
Log:
Simplify INT_NEG_OVF.


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/compile.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/compile.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/compile.py	Tue Jun  9 12:33:03 2009
@@ -332,14 +332,10 @@
         self._generate_ovf_op(op, self.cpu.f_mul_ovf)
 
     def generate_INT_NEG_OVF(self, op):
-        arg = self.getintarg(op.args[0])
-        self.vars[op.result] = llvm_rffi.LLVMBuildNeg(self.builder, arg, "")
-        ovf = llvm_rffi.LLVMBuildICmp(self.builder,
-                                      llvm_rffi.Predicate.EQ,
-                                      arg,
-                                      self.cpu.const_minint,
-                                      "")
-        self._generate_set_ovf(ovf)
+        self._generate_ovf_test(self.cpu.f_sub_ovf,
+                                self.cpu.const_zero,
+                                self.getintarg(op.args[0]),
+                                op.result)
 
     def generate_INT_LSHIFT_OVF(self, op):
         arg0 = self.getintarg(op.args[0])

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/runner.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/backend/llvm/runner.py	Tue Jun  9 12:33:03 2009
@@ -84,7 +84,6 @@
         self.ty_unichar_ptr = llvm_rffi.LLVMPointerType(self.ty_unichar, 0)
         self.const_zero = self._make_const_int(0)
         self.const_one  = self._make_const_int(1)
-        self.const_minint = self._make_const_int(-sys.maxint-1)
         self.const_null_charptr = self._make_const(0, self.ty_char_ptr)
         #
         from pypy.jit.backend.llvm.compile import LLVMJITCompiler



More information about the Pypy-commit mailing list