Re: combine permutations in gimple

2012-08-20 Thread Richard Guenther
On Sat, Aug 18, 2012 at 11:59 AM, Marc Glisse marc.gli...@inria.fr wrote: Hello, here is a new patch (passes bootstrap+regtest), which only combines permutations if the result is the identity. I'll file a PR about more general combinations to link to this conversation and the cost hook

Re: combine permutations in gimple

2012-08-16 Thread Hans-Peter Nilsson
On Wed, 15 Aug 2012, Richard Guenther wrote: On Wed, Aug 15, 2012 at 1:56 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: Of-course, the problem here is this change of semantics with the hook TARGET_VEC_PERM_CONST_OK. Targets were expanding to generic permutes with

Re: combine permutations in gimple

2012-08-15 Thread Marc Glisse
On Mon, 13 Aug 2012, Marc Glisse wrote: I'll give it a few more days for the conversation to settle, so I know what I should do between: - the barely modified patch you accepted, - the check asked by Jakub, - the restriction to identity that prevents any regression (well...), - something else?

Re: combine permutations in gimple

2012-08-15 Thread Richard Guenther
On Wed, Aug 15, 2012 at 1:22 PM, Marc Glisse marc.gli...@inria.fr wrote: On Mon, 13 Aug 2012, Marc Glisse wrote: I'll give it a few more days for the conversation to settle, so I know what I should do between: - the barely modified patch you accepted, - the check asked by Jakub, - the

Re: combine permutations in gimple

2012-08-15 Thread Ramana Radhakrishnan
[It looks like I missed hitting the send button on this response] Seems to be one instruction shorter at least ;-) Yes, there can be much worse regressions than that because of the patch (like 40 instructions instead of 4, in the x86 backend). If this is replacing 4 instructions with 40 in

Re: combine permutations in gimple

2012-08-15 Thread Richard Guenther
On Wed, Aug 15, 2012 at 1:56 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: [It looks like I missed hitting the send button on this response] Seems to be one instruction shorter at least ;-) Yes, there can be much worse regressions than that because of the patch (like 40

Re: combine permutations in gimple

2012-08-15 Thread Jakub Jelinek
On Wed, Aug 15, 2012 at 01:46:05PM +0200, Richard Guenther wrote: Well, we're waiting for someone to break the tie ... I'd go with the original patch, improving the backends where necessary. E.g. i?86/x86_64 with just plain -msse2 has only very small subset of constant shuffles (and no variable

Re: combine permutations in gimple

2012-08-15 Thread Richard Guenther
On Wed, Aug 15, 2012 at 2:07 PM, Jakub Jelinek ja...@redhat.com wrote: On Wed, Aug 15, 2012 at 01:46:05PM +0200, Richard Guenther wrote: Well, we're waiting for someone to break the tie ... I'd go with the original patch, improving the backends where necessary. E.g. i?86/x86_64 with just

Re: combine permutations in gimple

2012-08-15 Thread Ramana Radhakrishnan
On 15 August 2012 13:07, Jakub Jelinek ja...@redhat.com wrote: On Wed, Aug 15, 2012 at 01:46:05PM +0200, Richard Guenther wrote: Well, we're waiting for someone to break the tie ... I'd go with the original patch, improving the backends where necessary. E.g. i?86/x86_64 with just plain -msse2

Re: combine permutations in gimple

2012-08-15 Thread Jakub Jelinek
On Wed, Aug 15, 2012 at 02:15:03PM +0200, Richard Guenther wrote: Ok. That would still leave us with the issue Ramana brought up - the target hook returning true unconditionally if a generic permute is implemented. We just avoid generic expansion by tree-vect-generic.c that way. Yeah, if

Re: combine permutations in gimple

2012-08-15 Thread Richard Guenther
On Wed, Aug 15, 2012 at 2:29 PM, Jakub Jelinek ja...@redhat.com wrote: On Wed, Aug 15, 2012 at 02:15:03PM +0200, Richard Guenther wrote: Ok. That would still leave us with the issue Ramana brought up - the target hook returning true unconditionally if a generic permute is implemented. We

Re: combine permutations in gimple

2012-08-15 Thread Richard Guenther
On Wed, Aug 15, 2012 at 2:53 PM, Jakub Jelinek ja...@redhat.com wrote: On Wed, Aug 15, 2012 at 02:36:54PM +0200, Richard Guenther wrote: On Wed, Aug 15, 2012 at 2:29 PM, Jakub Jelinek ja...@redhat.com wrote: On Wed, Aug 15, 2012 at 02:15:03PM +0200, Richard Guenther wrote: Ok. That would

Re: combine permutations in gimple

2012-08-13 Thread Richard Guenther
On Sat, Aug 11, 2012 at 2:25 PM, Marc Glisse marc.gli...@inria.fr wrote: On Fri, 10 Aug 2012, Marc Glisse wrote: this patch detects permutations of permutations and merges them. It also canonicalizes permutations a bit more. There are several issues with this patch: 1) I am not sure we

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Richard Guenther wrote: On Sat, Aug 11, 2012 at 2:25 PM, Marc Glisse marc.gli...@inria.fr wrote: On Fri, 10 Aug 2012, Marc Glisse wrote: 1) I am not sure we always want to combine permutations. Indeed, someone (user? vectorizer?) may have written 2 permutations to help

Re: combine permutations in gimple

2012-08-13 Thread Richard Guenther
On Mon, Aug 13, 2012 at 3:03 PM, Marc Glisse marc.gli...@inria.fr wrote: On Mon, 13 Aug 2012, Richard Guenther wrote: On Sat, Aug 11, 2012 at 2:25 PM, Marc Glisse marc.gli...@inria.fr wrote: On Fri, 10 Aug 2012, Marc Glisse wrote: 1) I am not sure we always want to combine permutations.

Re: combine permutations in gimple

2012-08-13 Thread Ramana Radhakrishnan
I guess people will complain soon enough if this causes horrible performance regressions in vectorized code. Not having looked at your patch in great detail,. surely what we don't want is a situation where 2 constant permutations are converted into one generic permute. Based on a quick read of

Re: combine permutations in gimple

2012-08-13 Thread Richard Guenther
On Mon, Aug 13, 2012 at 3:12 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: I guess people will complain soon enough if this causes horrible performance regressions in vectorized code. Not having looked at your patch in great detail,. surely what we don't want is a situation

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Richard Guenther wrote: On Mon, Aug 13, 2012 at 3:12 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: I guess people will complain soon enough if this causes horrible performance regressions in vectorized code. Not having looked at your patch in great

Re: combine permutations in gimple

2012-08-13 Thread Jakub Jelinek
On Mon, Aug 13, 2012 at 03:13:26PM +0200, Richard Guenther wrote: On Mon, Aug 13, 2012 at 3:12 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: I guess people will complain soon enough if this causes horrible performance regressions in vectorized code. Not having

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Richard Guenther wrote: + /* Check that it is only used here. We cannot use has_single_use + since the expression is using it twice itself... */ Ah ... so then || num_imm_uses (op0) != 2 Ah, ok, that's simpler indeed, but there were such dire warnings

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Jakub Jelinek wrote: On Mon, Aug 13, 2012 at 03:13:26PM +0200, Richard Guenther wrote: The patch does not do that. It merely assumes that the target knows how to perform an optimal constant permute and that two constant permutes never generate better code than a single

Re: combine permutations in gimple

2012-08-13 Thread Jakub Jelinek
On Mon, Aug 13, 2012 at 03:45:00PM +0200, Marc Glisse wrote: On Mon, 13 Aug 2012, Jakub Jelinek wrote: On Mon, Aug 13, 2012 at 03:13:26PM +0200, Richard Guenther wrote: The patch does not do that. It merely assumes that the target knows how to perform an optimal constant permute and that

Re: combine permutations in gimple

2012-08-13 Thread Ramana Radhakrishnan
On 13 August 2012 14:21, Marc Glisse marc.gli...@inria.fr wrote: On Mon, 13 Aug 2012, Richard Guenther wrote: On Mon, Aug 13, 2012 at 3:12 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: I guess people will complain soon enough if this causes horrible performance

Re: combine permutations in gimple

2012-08-13 Thread Ramana Radhakrishnan
On 13 August 2012 14:54, Jakub Jelinek ja...@redhat.com wrote: On Mon, Aug 13, 2012 at 03:45:00PM +0200, Marc Glisse wrote: On Mon, 13 Aug 2012, Jakub Jelinek wrote: On Mon, Aug 13, 2012 at 03:13:26PM +0200, Richard Guenther wrote: The patch does not do that. It merely assumes that the

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Ramana Radhakrishnan wrote: On 13 August 2012 14:21, Marc Glisse marc.gli...@inria.fr wrote: On Mon, 13 Aug 2012, Richard Guenther wrote: On Mon, Aug 13, 2012 at 3:12 PM, Ramana Radhakrishnan ramana.radhakrish...@linaro.org wrote: I guess people will complain soon

Re: combine permutations in gimple

2012-08-13 Thread Marc Glisse
On Mon, 13 Aug 2012, Marc Glisse wrote: On Mon, 13 Aug 2012, Richard Guenther wrote: If your new predicate would match more places (can you do a quick search?) You mean: if there are more optimizations that either already check for double use in the same statement, or could benefit from

Re: combine permutations in gimple

2012-08-11 Thread Marc Glisse
On Fri, 10 Aug 2012, Marc Glisse wrote: this patch detects permutations of permutations and merges them. It also canonicalizes permutations a bit more. There are several issues with this patch: 1) I am not sure we always want to combine permutations. Indeed, someone (user? vectorizer?) may

Re: combine permutations in gimple

2012-08-10 Thread Marc Glisse
On Fri, 10 Aug 2012, Marc Glisse wrote: There are several issues with this patch: Oups: 5) and the testcase needs fixing, just like Jakub just fixed Richard's testcase, to avoid ABI warnings. But that's easy. -- Marc Glisse