public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: "Hurugalawadi, Naveen" <Naveen.Hurugalawadi@caviumnetworks.com>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t & ~1)
Date: Thu, 09 Jul 2015 08:57:00 -0000	[thread overview]
Message-ID: <CAFiYyc1KyF10XcbHzr8z_YZi5CKGd=YEHopedEU+_c0z3ituXg@mail.gmail.com> (raw)
In-Reply-To: <559E162B.9040609@gnu.org>

On Thu, Jul 9, 2015 at 8:35 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>
>
> On 07/07/2015 11:08, Richard Biener wrote:
>> Also I am not sure ceil_div and floor_div can be handled this way.
>> (5 /[ceil] 2) * 2 == 6 but you compute it as 4.  So I am only convinced
>> trunc_div works this way.
>
> Of course also floor_div for unsigned arguments.
>
> For signed arguments, ceil_div works if the operand is known-negative
> and floor_div if known-positive.
>
> Perhaps you could optimize these cases to trunc_div first (or maybe it's
> already done...)?

fold-const.c does this already, yes.

Richard.

> Paolo

  reply	other threads:[~2015-07-09  8:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  4:55 Hurugalawadi, Naveen
2015-07-07  9:08 ` Richard Biener
2015-07-09  6:35   ` Paolo Bonzini
2015-07-09  8:57     ` Richard Biener [this message]
2015-07-21  9:21   ` Hurugalawadi, Naveen
2015-07-22 12:16     ` Richard Biener
2015-07-23  7:26       ` Hurugalawadi, Naveen
2015-07-23 13:36         ` Richard Biener

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='CAFiYyc1KyF10XcbHzr8z_YZi5CKGd=YEHopedEU+_c0z3ituXg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=Naveen.Hurugalawadi@caviumnetworks.com \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@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).