Path: utzoo!attcan!uunet!husc6!rice!titan!david
From: david@titan.rice.edu (David Callahan)
Newsgroups: comp.arch
Subject: Re: getting rid of branches
Message-ID: <1629@kalliope.rice.edu>
Date: 6 Jul 88 22:07:44 GMT
References: <28200173@urbsdc> <53161@ti-csl.CSNET> <18830@cornell.UUCP> <880@garth.UUCP>
Sender: usenet@rice.edu
Reply-To: david@titan.rice.edu (David Callahan)
Organization: Rice University, Houston
Lines: 34

In article <880@garth.UUCP> smryan@garth.UUCP (Steven Ryan) writes:
>>            ex1 = .true.
>>            do 100 i = 1, 100
>>               if (ex1) statement1          <-----(1)
>>               if (ex1) ex1 = .not. x(i)    <-----(2)
>>               if (ex1) statement2
>>        100 continue
>>            if (.not. ex1) goto 200
>>            statement3
>>        200 statement4
>>
>>the do loop can now be vectorized.
>
>Actually, I don't think so: the reference to ex1 in (1) is before a definition
>in (2), ex1 is recursive.
>

I don't know who made the original statement. 
The loop can be ``partially vectorized'' if not all of
the statements are part of the computation of the
exit branch (part of the the strongly connected 
component of the data dependence graph that contains
the assignment to "ex1"). The loop can be distributed
so that the vectorizable statements are isolated from
the exit computation. The exit computation is then
used to compute a new trip count for the other loops.

The exit flags do not appear in the guards on the
statements during execution but are used to remember
which exit was taken. This approach can also be applied
uniformly to "while" loops.

David Callahan
Rice University