From: Eric Botcazou <ebotcazou@adacore.com>
To: DJ Delorie <dj@redhat.com>
Cc: gcc@gcc.gnu.org
Subject: Re: may_be_unaligned_p bug?
Date: Sun, 11 Apr 2010 02:28:00 -0000 [thread overview]
Message-ID: <201004101535.45423.ebotcazou@adacore.com> (raw)
In-Reply-To: <201004101301.09200.ebotcazou@adacore.com>
> Index: tree-ssa-loop-ivopts.c
> ===================================================================
> --- tree-ssa-loop-ivopts.c (revision 158148)
> +++ tree-ssa-loop-ivopts.c (working copy)
> @@ -1546,6 +1546,9 @@ may_be_unaligned_p (tree ref, tree step)
>
> || bitpos % BITS_PER_UNIT != 0)
>
> return true;
>
> + if (toffset && !constant_multiple_of (toffset, al, &mul))
> + return true;
> +
> if (!constant_multiple_of (step, al, &mul))
> return true;
> }
constant_multiple_of is too restrictive though, something like:
Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c (revision 158148)
+++ tree-ssa-loop-ivopts.c (working copy)
@@ -1537,16 +1537,18 @@ may_be_unaligned_p (tree ref, tree step)
if (mode != BLKmode)
{
- double_int mul;
- tree al = build_int_cst (TREE_TYPE (step),
- GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT);
+ unsigned mode_align = GET_MODE_ALIGNMENT (mode);
- if (base_align < GET_MODE_ALIGNMENT (mode)
- || bitpos % GET_MODE_ALIGNMENT (mode) != 0
- || bitpos % BITS_PER_UNIT != 0)
+ if (base_align < mode_align
+ || (bitpos % mode_align) != 0
+ || (bitpos % BITS_PER_UNIT) != 0)
return true;
- if (!constant_multiple_of (step, al, &mul))
+ if (toffset
+ && (highest_pow2_factor (toffset) * BITS_PER_UNIT) < mode_align)
+ return true;
+
+ if ((highest_pow2_factor (step) * BITS_PER_UNIT) < mode_align)
return true;
}
--
Eric Botcazou
next prev parent reply other threads:[~2010-04-10 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-10 11:02 DJ Delorie
2010-04-10 13:03 ` Eric Botcazou
2010-04-11 2:28 ` Eric Botcazou [this message]
2010-04-12 21:08 ` DJ Delorie
2010-04-12 22:17 ` Eric Botcazou
2010-04-12 22:25 ` DJ Delorie
2010-04-13 22:15 ` Eric Botcazou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201004101535.45423.ebotcazou@adacore.com \
--to=ebotcazou@adacore.com \
--cc=dj@redhat.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).