From: Bernd Schmidt <bschmidt@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>, gcc-patches@gcc.gnu.org
Cc: dje.gcc@gmail.com
Subject: Re: [PATCH 1/2] simplify-rtx: Simplify trunc of and of shiftrt
Date: Tue, 10 Nov 2015 11:16:00 -0000 [thread overview]
Message-ID: <5641D1F9.3090104@redhat.com> (raw)
In-Reply-To: <1d3e9ff999e20e4eb13a5825ac084074bd05a397.1447053652.git.segher@kernel.crashing.org>
On 11/09/2015 08:33 AM, Segher Boessenkool wrote:
> If we have
>
> (truncate:M1 (and:M2 (lshiftrt:M2 (x:M2) C) C2))
>
> we can write it instead as
>
> (and:M1 (lshiftrt:M1 (truncate:M1 (x:M2)) C) C2)
>
>
> + /* Likewise (truncate:QI (and:SI (lshiftrt:SI (x:SI) C) C2)) into
> + (and:QI (lshiftrt:QI (truncate:QI (x:SI)) C) C2) for suitable C
> + and C2. */
> + if (GET_CODE (op) == AND
> + && (GET_CODE (XEXP (op, 0)) == LSHIFTRT
> + || GET_CODE (XEXP (op, 0)) == ASHIFTRT)
> + && CONST_INT_P (XEXP (XEXP (op, 0), 1))
> + && CONST_INT_P (XEXP (op, 1))
> + && UINTVAL (XEXP (XEXP (op, 0), 1)) < precision
> + && ((GET_MODE_MASK (mode) >> UINTVAL (XEXP (XEXP (op, 0), 1)))
> + & UINTVAL (XEXP (op, 1)))
> + == ((GET_MODE_MASK (op_mode) >> UINTVAL (XEXP (XEXP (op, 0), 1)))
> + & UINTVAL (XEXP (op, 1))))
In general this would be easier to read if there were intermediate
variables called shift_amount and mask. I'm not entirely sure what the
last condition here is supposed to test. Is it related to...
> + return simplify_gen_binary (AND, mode, op0, XEXP (op, 1));
... the fact that here I think you'd have to trunc_int_for_mode the AND
amount for the smaller mode?
Bernd
next prev parent reply other threads:[~2015-11-10 11:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 7:33 Segher Boessenkool
2015-11-09 7:33 ` [PATCH 2/2] rs6000: Extend 20050603-3.c testcase to 64-bit Segher Boessenkool
2015-11-09 16:22 ` David Edelsohn
2015-11-10 11:16 ` Bernd Schmidt [this message]
2015-11-10 17:44 ` [PATCH 1/2] simplify-rtx: Simplify trunc of and of shiftrt Segher Boessenkool
2015-11-10 21:04 ` Bernd Schmidt
2015-11-11 14:15 ` Segher Boessenkool
2015-11-13 10:03 Uros Bizjak
2015-11-13 14:36 ` Segher Boessenkool
2015-11-13 15:57 ` Uros Bizjak
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=5641D1F9.3090104@redhat.com \
--to=bschmidt@redhat.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=segher@kernel.crashing.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).