This is the mail archive of the gcc@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: Question about vectorization limit


On Fri, May 31, 2013 at 3:48 PM, Toon Moene <toon@moene.org> wrote:
> On 05/31/2013 03:41 PM, Jakub Jelinek wrote:
>
>> On Fri, May 31, 2013 at 03:21:51PM +0200, Toon Moene wrote:
>
>
>>> SUBROUTINE XYZ(A, B, N)
>>> DIMENSION A(N), B(N)
>>> DO I = 1, N
>>>     IF (A(I)>  0.0) THEN
>>>        A(I) = B(I) / A(I)
>>>     ELSE
>>>        A(I) = B(I)
>>>     ENDIF
>>> ENDDO
>>> END
>>
>>
>> Well, in this case (with -Ofast) it is just the case that ifcvt
>> or earlier passes did a poor job at moving the load from B(I)
>> before the conditional, which, if we ignore exceptions, should be
>> possible,
>> as both branches read from the same memory.
>> The store to A(I) is already hoisted by cselim out of the conditional.
>>
>> If you rewrite the above into:
>> SUBROUTINE XYZ(A, B, N)
>> DIMENSION A(N), B(N)
>> DO I = 1, N
>>     C = B(I)
>>     IF (A(I)>  0.0) THEN
>>        A(I) = C / A(I)
>>     ELSE
>>        A(I) = C
>>     ENDIF
>> ENDDO
>> END
>>
>> then it is vectorized just fine.
>
>
> But this "inner loop" has at least 3 basic blocks - so what does the
> "loop->num_nodes != 2" test exactly codify ?
>
> Is Dehao just looking at the wrong test ?  And why is this test there ?

As I said, the test is there to early out for loops we can't vectorize anyway
(currently, that is, as Jakub says in future we may have infrastructure to
deal with some cases).

Richard.


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