This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for mips offs > 16bit, *kludge* for egcs-1.1.2 release
- To: egcs-patches at egcs dot cygnus dot com
- Subject: Patch for mips offs > 16bit, *kludge* for egcs-1.1.2 release
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- Date: Sun, 28 Feb 1999 10:14:14 -0500 (EST)
- cc: pefo at opsycon dot se, law at cygnus dot com, jonathan at DSG dot Stanford dot EDU
I took a shot at this, even though I know diddley about mips
(not really necessary when you have the GCC machine description,
and has ignorance ever stopped anybody anyway? 1/2 :-)
Configured for --target=mipsel-unknown-netbsd (host =
i686-pc-linux-gnulibc1), the bug shows up with the test-cases in
<URL:http://egcs.cygnus.com/ml/egcs-bugs/1999-02/msg00786.html>
and <URL:http://www.cygnus.com/ml/egcs-bugs/1998-Oct/0928.html>,
running with no optimization; no flags at all to cc1.
There is an analysis of the problem in
<URL:http://www.cygnus.com/ml/egcs-bugs/1998-Oct/0928.html>, but
I don't really agree with that (mips-centric) analysis except
which change that caused the failure; the main problem is not
any specific badness in the mips port.
The problem is that in the quoted change (1.76 of expr.c) in
expand_assignment and expand_expr (maybe elsewhere). The movP
(movsi, movdi) pattern is used through a call to emit_move_insn
without making sure that the input operand is a valid operand
for that pattern.
In this case it is an address, a (plus ...)-expression. This
is not valid input to emit_move_insn, (which passes it on to
gen_movsi, or gen_movdi for 64-bit targets, without checking or
correcting for predicates).
Much later, it fails to be recognized -- unless optimizing, in
which case combine will do tricks and reshape the operands so it
will be recognized.
For the release-branch, here's a patch that does *not* try to
correct the general badness (next patch), but instead try and
confine a fix for the mips target only; (included here). If the
kludgyness of this patch causes indigestion, then please look at
the general correction in expr.c with the *next* patch (similar
subject); I do prefer that one and believe it is more correct.
With this patch, those two testcases seem to work (beware of my
mips-cluelessness). Nothing else tested; I don't have a mips
machine. Any mips people around?
Sun Feb 28 11:30:57 1999 Hans-Peter Nilsson <hp@bitrange.com>
* config/mips/mips.md (movsi, movdi: Adjust operand 1 if not
general_operand.
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.md,v
retrieving revision 1.31.2.1
diff -p -c -r1.31.2.1 mips.md
*** mips.md 1998/07/20 22:15:33 1.31.2.1
--- mips.md 1999/02/28 11:28:49
***************
*** 3,9 ****
;; Changes by Michael Meissner, meissner@osf.org
;; 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
;; Brendan Eich, brendan@microunity.com.
! ;; Copyright (C) 1989, 90-97, 1998 Free Software Foundation, Inc.
;; This file is part of GNU CC.
--- 3,9 ----
;; Changes by Michael Meissner, meissner@osf.org
;; 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
;; Brendan Eich, brendan@microunity.com.
! ;; Copyright (C) 1989, 90-98, 1999 Free Software Foundation, Inc.
;; This file is part of GNU CC.
*************** move\\t%0,%z4\\n\\
*** 4500,4505 ****
--- 4500,4514 ----
emit_move_insn (operands[0], temp);
DONE;
}
+
+ /* Kludge for a bug in egcs 1.1.2 causing source operand with
+ unchecked predicate to appear here. */
+ if (! general_operand (operands[1], DImode)
+ && reload_in_progress == 0 && reload_completed == 0)
+ {
+ emit_move_insn (operands[0], force_operand (operands[1], NULL_RTX));
+ DONE;
+ }
}")
;; For mips16, we need a special case to handle storing $31 into
*************** move\\t%0,%z4\\n\\
*** 4913,4918 ****
--- 4922,4936 ----
{
rtx temp = force_reg (SImode, operands[1]);
emit_move_insn (operands[0], temp);
+ DONE;
+ }
+
+ /* Kludge for a bug in egcs 1.1.2 causing source operand with
+ unchecked predicate to appear here. */
+ if (! general_operand (operands[1], SImode)
+ && reload_in_progress == 0 && reload_completed == 0)
+ {
+ emit_move_insn (operands[0], force_operand (operands[1], NULL_RTX));
DONE;
}
}")
brgds, H-P