This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: simplify_and_const_int - disable call to force_to_mode
- To: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: PATCH: simplify_and_const_int - disable call to force_to_mode
- From: Toshi Morita <moritat at hsa dot hitachi dot com>
- Date: Mon, 26 Feb 2001 11:00:21 -0800
- Organization: Hitachi Semiconductor America
This problem exists in both gcc-2.95.3-test3 and the gcc-3.0 branch.
If this is acceptable, please apply to both branches.
Mon Feb 26 10:37:43 PST 2001 Toshiyasu Morita (tm2@best.com)
* combine.c (simplify_and_const_int): Disable call to
force_to_mode.
*** combine.c.bak Thu Feb 22 20:49:53 2001
--- combine.c Mon Feb 26 10:36:09 2001
***************
*** 7317,7325 ****
--- 7317,7347 ----
int width = GET_MODE_BITSIZE (mode);
int i;
+ #if 0
+ /* This optimization is invalid because force_to_mode is designed to
+ propogate the bitmask for a mode into the subexpressions of an
expression.
+ It does NOT always return an expression truncated to an arbitrary
bitmask.
+
+ Basically, when this code is enabled, simplify_and_const_it
simplifies:
+
+ (set (reg/v:SI 57) (const_int 0))
+
+ (and:SI (plus:SI (reg/v:SI 57)
+ (const_int 23 [0x17]))
+ (const_int 60 [0x3c]))
+
+ to:
+
+ (const_int 23 [0x17])
+
+ because force_to_mode is forced to widen the mask because the
+ low-order bits affect the result.
+ */
+
/* Simplify VAROP knowing that we will be only looking at some of the
bits in it. */
varop = force_to_mode (varop, mode, constop, NULL_RTX, 0);
+ #endif
/* If VAROP is a CLOBBER, we will fail so return it; if it is a
CONST_INT, we are done. */