public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Georg-Johann Lay <avr@gjlay.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Bernd Schmidt <bernds@codesourcery.com>,
	 Eric Botcazou <ebotcazou@adacore.com>,
	Richard Sandiford <richard.sandiford@linaro.org>,
	 Richard Henderson <rth@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] For FFS/CLZ/CTZ/CLRSB/POPCOUNT/PARITY/BSWAP require operand mode equal to operation mode (or VOIDmode) (PR middle-end/50161)
Date: Tue, 23 Aug 2011 14:54:00 -0000	[thread overview]
Message-ID: <4E53B0BA.5030309@gjlay.de> (raw)
In-Reply-To: <20110823120605.GE2687@tyan-ft48-01.lab.bos.redhat.com>

Jakub Jelinek wrote:
> On Tue, Aug 23, 2011 at 11:57:58AM +0200, Bernd Schmidt wrote:
>> On 08/23/11 11:52, Jakub Jelinek wrote:
>>> On Tue, Aug 23, 2011 at 11:35:07AM +0200, Bernd Schmidt wrote:
>>>>> cse_process_notes_1
>>>>> perhaps could be changed for VOIDmode new_rtx to try to
>>>>> simplify_replace_rtx it...
>>>> Is this where the problem came from? Sounds like it's worth a try.
>>> In this case, yes.  But there are many other places all around the
>>> compiler that need to disallow unary op with VOIDmode operand.
>>> In cse.c alone e.g. fold_rtx (twice), in combine.c e.g. in do_SUBST,
>>> subst, etc.  Do we want to special case all those 7 unary ops there too?
>>> Is it really worth it to save one subreg or truncate in the md patterns
>>> for rarely used rtxes?
>> Maybe not. I'll approve a patch to change it back, even if I think it's
>> not a good representation.
> 
> We can remove that restriction again once CONST_INTs are no longer VOIDmode.
> 
> Here is an untested patch, will bootstrap/regtest it now on x86_64-linux
> and i686-linux, on c6x it should make no difference IMHO (looked like a typo
> in the expander which wasn't used anyway), can somebody test it on AVR and

Tested you patch against r177949 on avr-unknown-none for C/C++.
There are no regressions and the new test case passes fine.

Johann

> BFIN?  My grepping through *.md didn't find any other places where the
> operand wouldn't have the same mode as operation.
> 
> 2011-08-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/50161
> 	* simplify-rtx.c (simplify_const_unary_operation): If
> 	op is CONST_INT, don't look at op_mode, but use instead
> 	mode.
> 	* optabs.c (add_equal_note): For FFS, CLZ, CTZ,
> 	CLRSB, POPCOUNT, PARITY and BSWAP use operand mode for
> 	operation and TRUNCATE/ZERO_EXTEND if needed.
> 	* doc/rtl.texi (ffs, clrsb, clz, ctz, popcount, parity, bswap):
> 	Document that operand mode must be same as operation mode,
> 	or VOIDmode.
> 	* config/avr/avr.md (paritysi2, *parityqihi2.libgcc,
> 	*paritysihi2.libgcc, popcountsi2, *popcountsi2.libgcc,
> 	*popcountqihi2.libgcc, clzsi2, *clzsihi2.libgcc, ctzsi2,
> 	*ctzsihi2.libgcc, ffssi2, *ffssihi2.libgcc): For unary ops
> 	use the mode of operand for the operation and add truncate
> 	or zero_extend around if needed.
> 	* config/c6x/c6x.md (ctzdi2): Likewise.
> 	* config/bfin/bfin.md (clrsbsi2, signbitssi2): Likewise.
> 
> 	* gcc.dg/pr50161.c: New test.

  reply	other threads:[~2011-08-23 13:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 13:06 Add __builtin_clrsb, similar to clz/ctz Bernd Schmidt
2011-06-16 13:10 ` Georg-Johann Lay
2011-06-16 13:56 ` Laurent Desnogues
2011-06-16 13:59   ` Bernd Schmidt
2011-06-16 17:03 ` Richard Henderson
2011-06-20 20:32   ` Bernd Schmidt
2011-06-20 20:48     ` Richard Henderson
2011-06-21 16:39     ` [PATCH] Fix __bultin_clrsb* (PR middle-end/49489) Jakub Jelinek
2011-06-21 16:46       ` Bernd Schmidt
2011-06-23  6:23     ` Add __builtin_clrsb, similar to clz/ctz H.J. Lu
2011-07-12  3:50     ` Hans-Peter Nilsson
2011-08-23 10:07     ` Jakub Jelinek
2011-08-23 10:08       ` Bernd Schmidt
2011-08-23 10:19         ` Richard Guenther
2011-08-23 10:25         ` Jakub Jelinek
2011-08-23 10:34           ` Bernd Schmidt
2011-08-23 13:43             ` [PATCH] For FFS/CLZ/CTZ/CLRSB/POPCOUNT/PARITY/BSWAP require operand mode equal to operation mode (or VOIDmode) (PR middle-end/50161) Jakub Jelinek
2011-08-23 14:54               ` Georg-Johann Lay [this message]
2011-08-23 15:58               ` Jakub Jelinek
2011-08-23 16:16                 ` Bernd Schmidt
2011-08-23 10:45         ` Add __builtin_clrsb, similar to clz/ctz Richard Sandiford

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=4E53B0BA.5030309@gjlay.de \
    --to=avr@gjlay.de \
    --cc=bernds@codesourcery.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.sandiford@linaro.org \
    --cc=rth@redhat.com \
    /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).