diff mbox

Cleaning up expand optabs code

Message ID g4vcz8vnql.fsf@linaro.org
State Accepted
Headers show

Commit Message

Richard Sandiford March 24, 2011, 10:04 a.m. UTC
"Anatoly Sokolov" <aesok@post.ru> writes:
> This patch casue ICE on H8300 target:

This is due to jump_address_operand checking the wrong mode.
The predicate is:

(define_predicate "jump_address_operand"
  (match_code "reg,mem")
{
  if (GET_CODE (op) == REG)
    return mode == Pmode;
  [...]
}

but "mode" is the mode passed to the predicate, not the mode of OP.
The indirect_jump pattern is:

(define_expand "indirect_jump"
  [(set (pc) (match_operand 0 "jump_address_operand" ""))]
  ""
  "")

which says that VOIDmode should be passed to jump_address_operand,
so all registers end up being rejected.

I've applied the following as the obvious fix.  You then hit bug
48263 ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48263 );
I'm testing a fix for that now.

Richard


gcc/
	* config/h8300/predicates.md (jump_address_operand): Fix register
	mode check.
diff mbox

Patch

Index: gcc/config/h8300/predicates.md
===================================================================
--- gcc/config/h8300/predicates.md	2011-01-05 15:12:08.000000000 +0000
+++ gcc/config/h8300/predicates.md	2011-03-24 09:20:15.000000000 +0000
@@ -259,7 +259,7 @@  (define_predicate "jump_address_operand"
   (match_code "reg,mem")
 {
   if (GET_CODE (op) == REG)
-    return mode == Pmode;
+    return GET_MODE (op) == Pmode;
 
   if (GET_CODE (op) == MEM)
     {