This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][vectorizer][2/2] PR 65951: Hook up mult synthesis logic into vectorisation of mult-by-constant


On Tue, 14 Jun 2016, Kyrill Tkachov wrote:

On 14/06/16 08:04, Marc Glisse wrote:
On Mon, 13 Jun 2016, Kyrill Tkachov wrote:

The new function vect_synth_mult_by_constant that does all the hard work is very similar in structure to expand_mult_const from expmed.c but it operates on gimple SSA rather than RTL.

I think in some cases this transformation creates undefined overflow from well-defined code. While this is fine in RTL, I would expect to need a cast to unsigned_type_for in gimple for some of the algorithms.
(not completely sure, just something to look at)

Would casting the initial argument to the unsigned type using fold_convert, performing the algorithm and then
casting the final result back to signed if necessary at the end work?

I don't know if fold_convert is the best interface for that, but yes, that should work. It is probably only needed in a few cases (if we multiply by a negative divisor of INT_MIN, or if the outermost operation is a subtraction, for instance), I don't know if detecting those is worth the trouble or we should always cast (when !TYPE_OVERFLOW_WRAPS).

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]