"unhandled use" in vectorizing a dot product?

Benjamin Redelings I benjamin_redelings@ncsu.edu
Tue Dec 1 16:07:00 GMT 2009


On 12/01/2009 02:28 AM, Ira Rosen wrote:
> Benjamin Redelings<benjamin_redelings@ncsu.edu>  wrote on 01/12/2009
> 01:24:15:
>    
>> Also, perhaps the documentation should explicitly say somewhere that
>> vectorization can depend on flags like this.  "unhandled use in
>> statement" certainly doesn't point the user to an idea of how to fix
>> this :-P
>>      
> The vectorizer prints:
>
>   "unsafe fp math optimization: sum_18 = D.2721_17 + sum_26;"
>
> But you are right, the bottom line printing:
>
>   "not vectorized: unsupported use in stmt."
>
> doesn't help much.
>
> Ira
>    
Hi Ira,

1.  That's actually quite helpful :-)  And thank you for all your work 
on this!  I can't wait to go make sure my actual code is autovectorized.

Anyway, I didn't see this because I didn't use 
-ftree-vectorizer-verbose=9.  Would it be possible to mention this at 
verbosity levels less than 9?  Ideally, level 2, which tells me which 
loops aren't vectorized without mentioning all the cost model parameters.

( BTW the gcc man pages indicate that 7 is the highest value for 
tree-vectorizer-verbose, although it seems that now 9 is the highest value.)

2. Interestingly, the following is recognized WITHOUT -ffast-math:

   for(i=0;i<argc;i++)
     f4[i] += f1[i]*f2[i]*f3[i];

If I change this to the following, then it needs -ffast-math:

   for(i=0;i<argc;i++)
     sum += f1[i]*f2[i]*f3[i];

This is essentially doing the first thing, plus also summing the f4[i].  
I guess that is the problem?

3. Finally, the following loop does not even receive a mention as being 
not vectorized (that I could find!)

  for(i=0;i<argc;i++)
     sum += d1[i]*d2[i]*d3[i]*d4[i];

Here d1, d2, d3, and d4 are double*.  However, the loop is recognized if 
they are float * OR of they are double* but there are only three of 
them.  I presume this is intended... can you explain why?

Thanks for all your help!

-BenRI






More information about the Gcc-help mailing list