This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] m68k.md: Fix PR target/23435. (Take 3)
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: law at redhat dot com, schwab at suse dot de, ian at airs dot com
- Date: Tue, 22 Nov 2005 09:04:04 -0800
- Subject: [patch] m68k.md: Fix PR target/23435. (Take 3)
Hi,
Attached is a patch to fix PR target/23435.
Consider the testcase, which triggers an unrecognized insn. This is
because zero_extendsidi2 accepts operands with both being MEM even
though *zero_extendsidi2 does not accept such operands. (Note that
there are two different patterns zero_extendsidi2 and
*zero_extendsidi2.)
The patch solves this problem by forcing operands[1] to a register if
both operands are MEM.
Tested on m68k-none-elf (modulo execution tests). Confirmed that the
patch fixed the attached testcase as well as
gcc.c-torture/compile/20010328-1.c. OK to apply?
Kazu Hirata
2005-11-22 Kazu Hirata <kazu@codesourcery.com>
PR target/23435
* m68k.md (zero_extendsidi2): Force operands[1] to a register
if both operands[0] and operands[1] are memory.
2005-11-22 Kazu Hirata <kazu@codesourcery.com>
PR target/23435
* gcc.c-torture/compile/pr23435.c: New.
Index: config/m68k/m68k.md
===================================================================
--- config/m68k/m68k.md (revision 107363)
+++ config/m68k/m68k.md (working copy)
@@ -1206,8 +1206,12 @@ (define_expand "zero_extendsidi2"
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
""
- "")
+{
+ if (GET_CODE (operands[0]) == MEM
+ && GET_CODE (operands[1]) == MEM)
+ operands[1] = force_reg (SImode, operands[1]);
+})
(define_insn_and_split "*zero_extendsidi2"
[(set (match_operand:DI 0 "nonimmediate_operand" "")
--- /dev/null 2005-09-01 09:08:28.063949816 -0700
+++ pr23435.c 2005-11-05 16:06:19.463244152 -0800
@@ -0,0 +1,11 @@
+/* PR target/23435.
+
+ On m68k-none-elf, this used to cause an unrecognized insn because
+ zero_extendsidi2 accepted operands that are both memory even though
+ such a pattern did not exist. */
+
+void
+foo (unsigned long *a, unsigned long long *p)
+{
+ *p = *a;
+}