(stabilize_reference_1): For division and remainder, make a save_expr.
authorRichard Stallman <rms@gnu.org>
Sat, 27 Mar 1993 07:23:42 +0000 (07:23 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 27 Mar 1993 07:23:42 +0000 (07:23 +0000)
From-SVN: r3889

gcc/tree.c

index 9033cc5cc4e61a024ff1183b8aa8c373b30dfbc5..0ce3ddb6cb7caecaed0577c0acd3045e1e0d4686 100644 (file)
@@ -1940,6 +1940,14 @@ stabilize_reference_1 (e)
       return e;
       
     case '2':
+      /* Division is slow and tends to be compiled with jumps,
+        especially the division by powers of 2 that is often
+        found inside of an array reference.  So do it just once.  */
+      if (code == TRUNC_DIV_EXPR || code == TRUNC_MOD_EXPR
+         || code == FLOOR_DIV_EXPR || code == FLOOR_MOD_EXPR
+         || code == CEIL_DIV_EXPR || code == CEIL_MOD_EXPR
+         || code == ROUND_DIV_EXPR || code == ROUND_MOD_EXPR)
+       return save_expr (e);
       /* Recursively stabilize each operand.  */
       result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)),
                         stabilize_reference_1 (TREE_OPERAND (e, 1)));