[backport gcc-4.9/trunk r198940 ] List-Archive: From: Andreas Schwab Subject: Fix rot[hq]i3+1 patterns in m68k backend Date: Wed, 15 May 2013 18:11:52 +0200 r198864 uncovered a very old bug in the m68k backend, introduced in 1997: probably due to a copy-paste bug the rot[hq]i3+1 patterns reference a non-existing operand. Apparently these patterns have never matched before. Tested on m68k-linux and checked in. Andreas. gcc/ 2013-05-15 Andreas Schwab * config/m68k/m68k.md (*rotlhi3_lowpart, *rotlqi3_lowpart): Name for rotlhi3+1 and rotlqi3+1, resp. Fix reference to non-existing third operand. --- gcc-4.7.3/gcc/config/m68k/m68k.md.~1~ 2011-11-27 00:59:56.000000000 +0100 +++ gcc-4.7.3/gcc/config/m68k/m68k.md 2013-05-18 11:43:54.063727188 +0200 @@ -5416,19 +5416,19 @@ (define_insn "rotlhi3" return "rol%.w %2,%0"; }) -(define_insn "" +(define_insn "*rotlhi3_lowpart" [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d")) (rotate:HI (match_dup 0) (match_operand:HI 1 "general_operand" "dIP")))] "!TARGET_COLDFIRE" { - if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8) + if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) >= 8) { - operands[2] = GEN_INT (16 - INTVAL (operands[2])); - return "ror%.w %2,%0"; + operands[1] = GEN_INT (16 - INTVAL (operands[1])); + return "ror%.w %1,%0"; } else - return "rol%.w %2,%0"; + return "rol%.w %1,%0"; }) (define_insn "rotlqi3" @@ -5446,19 +5446,19 @@ (define_insn "rotlqi3" return "rol%.b %2,%0"; }) -(define_insn "" +(define_insn "*rotlqi3_lowpart" [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d")) (rotate:QI (match_dup 0) (match_operand:QI 1 "general_operand" "dI")))] "!TARGET_COLDFIRE" { - if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4) + if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) >= 4) { - operands[2] = GEN_INT (8 - INTVAL (operands[2])); - return "ror%.b %2,%0"; + operands[1] = GEN_INT (8 - INTVAL (operands[1])); + return "ror%.b %1,%0"; } else - return "rol%.b %2,%0"; + return "rol%.b %1,%0"; }) (define_insn "rotrsi3"