On 11/20/2013 07:44 PM, Jakub Jelinek wrote: > On Wed, Nov 20, 2013 at 10:31:38AM +0100, Richard Biener wrote: >> Aww ;) Nice improvement. Generally when I see this I always wonder >> whether we want to do this kind of stuff pre RTL expansion. >> 1st to not rely on being able to TER, 2nd to finally eventually >> get rid of TER. >> >> These patches are unfortunately a step backward for #2. >> >> As of the patch, do we have a way to query whether the target >> can efficiently broadcast? If so this IMHO belongs in generic > > We don't. Perhaps if we'd add optab for vec_dup<mode> and mentioned > clearly in the documentation that it should be used only if it is reasonably > efficient. But still, even with optab, it would probably better to do it > in the veclower* passes than in the vectorizer itself.
I think we can assume that broadcast is relatively efficient, whether or not vec_dup is present. I'd lean to making the transformation generic to start with, so that you don't need extra handling in the i386 backend. Surely any operation with a common operand and a constant operand should be applicable for this transformation. r~