Skip to content

Commit b4e13ac

Browse files
author
Claudiu Zissulescu
committed
Fix handling of predicated commutative operations
1 parent 2a3d304 commit b4e13ac

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gcc/config/arc/arc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7986,6 +7986,18 @@ arc_output_commutative_cond_exec (rtx *operands, bool output_p)
79867986
/* Canonical rtl should not have a constant in the first operand position. */
79877987
gcc_assert (!CONSTANT_P (operands[1]));
79887988

7989+
/* Arrange the operands as required by predicated insns. */
7990+
if ((GET_CODE (operands[1]) == REG)
7991+
&& (GET_CODE (operands[2]) == REG))
7992+
{
7993+
if (REGNO (operands[0]) != REGNO (operands[1]))
7994+
{
7995+
rtx tmp = operands[1];
7996+
operands[1] = operands[2];
7997+
operands[2] = tmp;
7998+
}
7999+
}
8000+
79898001
switch (commutative_op)
79908002
{
79918003
case AND:

0 commit comments

Comments
 (0)