From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Wilson To: law@cygnus.com Cc: Toon Moene , egcs@cygnus.com Subject: Re: my EGCS status (really Fortran patches) Date: Mon, 27 Oct 1997 16:30:00 -0000 Message-id: <199710272237.OAA21142@cygnus.com> References: <25086.877886431@hurl.cygnus.com> X-SW-Source: 1997-10/msg01163.html I was looking at this patch. I see that you have installed the first hunk, but the second hunk is still missing. The second hunk is accidentally losing a SAVE_EXPR which needs to be fixed before we could install it. *** egcs-970929/gcc/fold-const.c.orig Fri Oct 3 10:07:37 1997 --- egcs-970929/gcc/fold-const.c Sat Oct 4 13:18:29 1997 *************** fold (expr) *** 4611,4619 **** operation, EXACT_DIV_EXPR. ! Note that only CEIL_DIV_EXPR is rewritten now, only because the ! others seem to be faster in some cases. This is probably just ! due to more work being done to optimize others in expmed.c than on ! EXACT_DIV_EXPR. */ ! if (code == CEIL_DIV_EXPR && multiple_of_p (type, arg0, arg1)) return fold (build (EXACT_DIV_EXPR, type, arg0, arg1)); --- 4611,4619 ---- operation, EXACT_DIV_EXPR. ! Note that only CEIL_DIV_EXPR and FLOOR_DIV_EXPR are rewritten now, ! only because the others seem to be faster in some cases. ! This is probably just due to more work being done to optimize ! others in expmed.c than on EXACT_DIV_EXPR. */ ! if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR) && multiple_of_p (type, arg0, arg1)) return fold (build (EXACT_DIV_EXPR, type, arg0, arg1)); *************** fold (expr) *** 4657,4660 **** --- 4657,4680 ---- STRIP_NOPS (xarg0); + if (TREE_CODE (xarg0) == MULT_EXPR + && multiple_of_p (type, TREE_OPERAND (xarg0, 0), arg1)) + { + return fold (build (MULT_EXPR, type, + fold (build (EXACT_DIV_EXPR, type, + TREE_OPERAND (xarg0, 0), + arg1)), + TREE_OPERAND (xarg0, 1))); + } + + if (TREE_CODE (xarg0) == MULT_EXPR + && multiple_of_p (Ttype, REE_OPERAND (xarg0, 1), arg1)) + { + return fold (build (MULT_EXPR, type, + fold (build (EXACT_DIV_EXPR, type, + TREE_OPERAND (xarg0, 1), + arg1)), + TREE_OPERAND (xarg0, 0))); + } + if (TREE_CODE (xarg0) == PLUS_EXPR && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST)