This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix a MIPS peephole2 (non-shared n64)


mips.md has a peephole2 to generate the "parallel" expansion of "la" for
non-shared n64.  The peephole requires a scratch register, which it gets
using a match_scratch.  Unfortunately, this match_scratch was in the
wrong place: it was asking for a register that was dead _before_ the
"la" instruction, not one that was dead after it.  This meant it could
sometimes pick the same register as the destination of the "la".

No MIPS configuration generates non-shared n64 libraries, so no
configuration is really set up for non-shared n64 execution tests.
This means I can't do normal dejagnu testing or provide a useful
dejagnu testcase.  (If it was possible to test using dejagnu,
I'm sure one of the existing tests would show up this bug anyway.)

The patch has been tested on a 64-bit linux kernel though, where it
fixes a previous miscompilation.  Applied to head.

Richard


	* config/mips/mips.md: Fix the placement of the match_scratch in the
	lea64 peephole2.

Index: config/mips/mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.311
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.311 mips.md
--- config/mips/mips.md	16 Nov 2004 19:24:17 -0000	1.311
+++ config/mips/mips.md	10 Feb 2005 20:37:56 -0000
@@ -2903,9 +2903,9 @@ (define_insn_and_split "*lea_high64"
 ;;	dsll32	op1,op1,0
 ;;	daddu	op1,op1,op0
 (define_peephole2
-  [(match_scratch:DI 0 "d")
-   (set (match_operand:DI 1 "register_operand")
-	(high:DI (match_operand:DI 2 "general_symbolic_operand")))]
+  [(set (match_operand:DI 1 "register_operand")
+	(high:DI (match_operand:DI 2 "general_symbolic_operand")))
+   (match_scratch:DI 0 "d")]
   "TARGET_EXPLICIT_RELOCS && ABI_HAS_64BIT_SYMBOLS"
   [(set (match_dup 1) (high:DI (match_dup 3)))
    (set (match_dup 0) (high:DI (match_dup 4)))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]