aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2015-11-12 10:28:19 +0100
committerClaudiu Zissulescu <claziss@gcc.gnu.org>2015-11-12 10:28:19 +0100
commitb1a827517a7268706919eeef7960db247307feb0 (patch)
tree678805cad6984eb97f4e2248db9840f6883d65ad
parent3826795b8c5540f1ec3da2c5b67957f29cde4bef (diff)
downloadgcc-b1a827517a7268706919eeef7960db247307feb0.zip
gcc-b1a827517a7268706919eeef7960db247307feb0.tar.gz
gcc-b1a827517a7268706919eeef7960db247307feb0.tar.bz2
arc.c (gen_compare_reg): Swap operands also when we do not expand to rtl.
2015-11-11 Claudiu Zissulescu <claziss@synopsys.com> * config/arc/arc.c (gen_compare_reg): Swap operands also when we do not expand to rtl. From-SVN: r230217
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/arc/arc.c16
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d292656..dd5df90 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-12 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * config/arc/arc.c (gen_compare_reg): Swap operands also when we
+ do not expand to rtl.
+
2015-11-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/58497
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 85d53e4..8bb0969 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1690,6 +1690,7 @@ gen_compare_reg (rtx comparison, machine_mode omode)
{
rtx op0 = gen_rtx_REG (cmode, 0);
rtx op1 = gen_rtx_REG (cmode, GET_MODE_SIZE (cmode) / UNITS_PER_WORD);
+ bool swap = false;
switch (code)
{
@@ -1698,15 +1699,19 @@ gen_compare_reg (rtx comparison, machine_mode omode)
break;
case LT: case UNGE: case LE: case UNGT:
code = swap_condition (code);
- tmp = x;
- x = y;
- y = tmp;
+ swap = true;
break;
default:
gcc_unreachable ();
}
if (currently_expanding_to_rtl)
{
+ if (swap)
+ {
+ tmp = x;
+ x = y;
+ y = tmp;
+ }
emit_move_insn (op0, x);
emit_move_insn (op1, y);
}
@@ -1714,6 +1719,11 @@ gen_compare_reg (rtx comparison, machine_mode omode)
{
gcc_assert (rtx_equal_p (op0, x));
gcc_assert (rtx_equal_p (op1, y));
+ if (swap)
+ {
+ op0 = y;
+ op1 = x;
+ }
}
emit_insn (gen_cmp_float (cc_reg, gen_rtx_COMPARE (mode, op0, op1)));
}