Instructions Separated by a Predicated Branch

In the following example, there are no dependency violations due to the unconditional compare. The instructions are numbered #1 through #6 for clarity.

The apparent WAW on R1 can never happen since instruction #2 and instruction #5 never execute in parallel. That is, instruction #2 executes (P2 true) implying that instruction #4 executes (P2 implies P1), and the code execution branches to L without reaching instruction #5.

The apparent WAW on R2 can only happen if instruction #4 does not execute and instruction #6 does. Since execution of instruction #6 (P3 true) implies execution of instruction #4 (P3 implies P1), the WAW never happens.

#1 (p1) cmp.eq.unc p2,p3=r1,r2;;
#2 (p2) mov r1=r10
#3 mov r2=r11
#4 (p1) br.cond.dpnt.few L
#5 mov r1=r12
#6 (p3) mov r2=r13

To avoid false reporting of WAW errors on R1 and R2, insert the “imply” form of the .pred.rel annotation:

(p1) cmp.eq.unc p2,p3=r1,r2;;
.pred.rel “imply”,p2,p1    ; if p2 is true, p1 is true
.pred.rel “imply”,p3,p1    ; same as above, with p3
(p2) mov r1=r10
mov r2=r11
(p1) br.cond.dpnt.few L
mov r1=r12
(p3) mov r2=r13