https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122141
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Known to fail| |12.1.0
Last reconfirmed| |2025-10-03
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
;; if (a_2(D) > b_3(D))
(jump_insn 9 8 0 (set (pc)
(if_then_else (gt (reg/v:DI 22 [ b ])
(reg/v:DI 21 [ a ]))
(label_ref 0)
(pc))) "/app/example.c":4:20 -1
(int_list:REG_BR_PROB 536870913 (nil)))
```
/* Without the conditional branch instructions jslt, jsle, jlt, jle, we need
to convert conditional branches that would use them to an available
operation instead by reversing the comparison. */
if ((code == LT || code == LE || code == LTU || code == LEU))
{
/* Reverse the condition. */
PUT_CODE (operands[0], reverse_condition (code));
/* Swap the operands, and ensure that the first is a register. */
if (!register_operand (operands[2], mode))
operands[2] = force_reg (mode, operands[2]);
rtx tmp = operands[1];
operands[1] = operands[2];
operands[2] = tmp;
}
```
So we start out with `if (b <= a) goto label 0` and then change it into `a > b`
but that is wrong. It is swap_condition which is needed here really.
This has been broken since -mcpu=v1 was added with r12-3450-g5b2ab1d35e4152.