aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2020-12-13 20:46:17 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2020-12-13 20:46:17 +0000
commit294ca9eca0293146d91768f7a75335fb642b489e (patch)
tree601edd7bf5a02ee8ab5cab2eea35166ae70bb7de /gcc
parentffb1dcf6222ef8bdbd234b34fe98a9cacc262f00 (diff)
downloadgcc-294ca9eca0293146d91768f7a75335fb642b489e.zip
gcc-294ca9eca0293146d91768f7a75335fb642b489e.tar.gz
gcc-294ca9eca0293146d91768f7a75335fb642b489e.tar.bz2
VAX: Handle subtracting from self with QMATH DImode add/sub
Remove an assertion the failure of which has not been actually observed, but which appears clearly dangerous, for when the QMATH DImode add/sub handler is invoked with the subtrahend and the minuend both the same. Instead handle the operation by emitting a move of constant 0 to the output operand. Adjust the relevant inline comment accordingly. gcc/ * config/vax/vax.c (vax_expand_addsub_di_operands): Handle equal input operands with subtraction.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/vax/vax.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 2274cce..07c499c 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -2042,12 +2042,14 @@ vax_expand_addsub_di_operands (rtx * operands, enum rtx_code code)
}
else
{
- /* If are adding the same value together, that's really a multiply by 2,
- and that's just a left shift of 1. */
+ /* If we are adding a value to itself, that's really a multiply by 2,
+ and that's just a left shift by 1. If subtracting, it's just 0. */
if (rtx_equal_p (operands[1], operands[2]))
{
- gcc_assert (code != MINUS);
- emit_insn (gen_ashldi3 (operands[0], operands[1], const1_rtx));
+ if (code == PLUS)
+ emit_insn (gen_ashldi3 (operands[0], operands[1], const1_rtx));
+ else
+ emit_move_insn (operands[0], const0_rtx);
return;
}