[patch] m68k/*.md: Fix PR target/24949.
Kazu Hirata
kazu@codesourcery.com
Wed Nov 23 03:19:00 GMT 2005
Hi,
Attached is a patch to fix PR target/24949.
The current GCC triggers an ICE while compiling
gcc.c-torture/compile/20000403-2.c
20000403-2.c: In function 'foo':
20000403-2.c:5: error: unrecognizable insn:
(insn 8 6 9 1
(set (mem/c/i:DI (reg/f:SI 25 virtual-incoming-args) [0 tmp+0 S8 A32])
(ashiftrt:DI (mem/c/i:DI (reg/f:SI 25 virtual-incoming-args) [0 tmp+0 S8 A32])
(const_int 32 [0x20]))) -1 (nil)
(nil))
This is because expander "ashrdi3" accepts shift count of 32, but the
corresponding define_insn pattern does not accept the shift count.
The patch solves this problem by making INTVAL checks consistent.
Specifically, with this patch, ashrdi3 rejects 32.
Tested on m68k-none-elf. OK to apply?
Kazu Hirata
2005-11-23 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.md (ashrdi_const32_mem, ashrdi3): Use
ashrdi_const_operand.
* config/m68k/predicates.md (ashrdi_const_operand): New.
Index: config/m68k/m68k.md
===================================================================
--- config/m68k/m68k.md (revision 107374)
+++ config/m68k/m68k.md (working copy)
@@ -4104,12 +4104,8 @@ (define_insn "ashrdi_const32_mem"
(define_insn "ashrdi_const"
[(set (match_operand:DI 0 "nonimmediate_operand" "=d")
(ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand 2 "const_int_operand" "n")))]
- "(!TARGET_COLDFIRE
- && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
- || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
- || INTVAL (operands[2]) == 31
- || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
+ (match_operand:DI 2 "ashrdi3_const_operand" "n")))]
+ "!TARGET_COLDFIRE"
{
operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
if (INTVAL (operands[2]) == 63)
@@ -4143,16 +4139,13 @@ (define_insn "ashrdi_const"
(define_expand "ashrdi3"
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(ashiftrt:DI (match_operand:DI 1 "general_operand" "")
- (match_operand 2 "const_int_operand" "")))]
+ (match_operand:DI 2 "const_int_operand" "")))]
"!TARGET_COLDFIRE"
"
{
/* ??? This is a named pattern like this is not allowed to FAIL based
on its operands. */
- if (GET_CODE (operands[2]) != CONST_INT
- || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
- && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
- && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
+ if (!ashrdi3_const_operand (operands[2], DImode))
FAIL;
} ")
Index: config/m68k/predicates.md
===================================================================
--- config/m68k/predicates.md (revision 107374)
+++ config/m68k/predicates.md (working copy)
@@ -194,3 +194,15 @@ (define_predicate "pre_dec_operand"
{
return MEM_P (op) && GET_CODE (XEXP (op, 0)) == PRE_DEC;
})
+
+;; True if accpetable for ashrdi3
+
+(define_predicate "ashrdi3_const_operand"
+ (match_code "const_int")
+{
+ HOST_WIDE_INT val = INTVAL (op);
+ return ((val >= 1 && val <= 3)
+ || val == 8 || val == 16
+ || val == 31
+ || (val > 32 && val <= 63));
+})
More information about the Gcc-patches
mailing list