This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] (X << C) >> C folding
- From: Richard Henderson <rth at redhat dot com>
- To: "James A. Morrison" <ja2morri at csclub dot uwaterloo dot ca>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 12 Jun 2005 20:13:22 -0700
- Subject: Re: [patch] (X << C) >> C folding
- References: <kfhpsur4fv4.fsf@csclub.uwaterloo.ca>
On Sun, Jun 12, 2005 at 01:58:07PM -0400, James A. Morrison wrote:
> * fold-const (fold_binary): Transform (X << C) >> C into X & (-1>>C)
> for unsigned types.
Not ok. The correct mask has C 0 bits at the top AND bottom. So,
for instance with C=4, MASK=0x0ffffff0 for a 32-bit type.
r~