On 04/10/2018 01:27 PM, Maciej W. Rozycki wrote:
> On Sun, 8 Apr 2018, Jeff Law wrote:
> 
>> I think you need to go back to my earlier reply and read it carefully.
>> In particular, you need an insn where the label_ref and pc are swapped.
> 
>  Ouch, there are no reversed interlocked branch instructions in the VAX 
> ISA, so these would have to branch around a jump.  Like say:
> 
> (define_insn "*jbbssisi_reversed"
>   [(parallel
>     [(set (pc)
>         (if_then_else
>           (ne (zero_extract:SI (match_operand:SI 0 "memory_operand" "Q")
>                                (const_int 1)
>                                (match_operand:SI 1 "general_operand" "nrm"))
>               (const_int 0))
>           (pc))
>           (label_ref (match_operand 2 "" "")))
>      (set (zero_extract:SI (match_operand:SI 3 "memory_operand" "+0")
>                          (const_int 1)
>                          (match_dup 1))
>         (const_int 1))])]
>   ""
>   "jbssi %1,%0,0f;jbr %l2;0:")
> 
> and likewise with the other modes.
> 
>  Is this what you have in mind?
Yea.  Various parts of GCC assume that it can swap the pc/label_ref to
invert the branch.  At least that was the case in the past.  You could
always create the pattern with the inefficient jump-around-jump to
verify behavior.

Wandering through jump.c it appears that it now tries to validate the
changes as they occur.  So if creating the swapped pattern works, it
might be beneficial to see which pass creates the swapped version and
see if it can be twiddled to use validate_change or a similar API to
avoid the need for the swapped pattern.


Jeff

Reply via email to