(simplify_binary_operation...
authorRichard Kenner <kenner@gcc.gnu.org>
Wed, 31 Mar 1993 20:57:24 +0000 (15:57 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 31 Mar 1993 20:57:24 +0000 (15:57 -0500)
(simplify_binary_operation, case MULT): When testing for
floating-point equality, make sure we do so inside a region protected
from traps.

From-SVN: r3963

gcc/cse.c

index a2aac9447fc555a456dac60cd617db5f75f4fd61..44c75e60cf570c96abe561c021eaf321c67158ba 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3565,15 +3565,23 @@ simplify_binary_operation (code, mode, op0, op1)
              && GET_MODE_CLASS (GET_MODE (op1)) == MODE_FLOAT)
            {
              REAL_VALUE_TYPE d;
+             jmp_buf handler;
+             int op1is2, op1ism1;
+
+             if (setjmp (handler))
+               return 0;
+
+             set_float_handler (handler);
              REAL_VALUE_FROM_CONST_DOUBLE (d, op1);
+             op1is2 = REAL_VALUES_EQUAL (d, dconst2);
+             op1ism1 = REAL_VALUES_EQUAL (d, dconstm1);
+             set_float_handler (NULL_PTR);
 
              /* x*2 is x+x and x*(-1) is -x */
-             if (REAL_VALUES_EQUAL (d, dconst2)
-                 && GET_MODE (op0) == mode)
+             if (op1is2 && GET_MODE (op0) == mode)
                return gen_rtx (PLUS, mode, op0, copy_rtx (op0));
 
-             else if (REAL_VALUES_EQUAL (d, dconstm1)
-                      && GET_MODE (op0) == mode)
+             else if (op1ism1 && GET_MODE (op0) == mode)
                return gen_rtx (NEG, mode, op0);
            }
          break;