http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22553
--- Comment #27 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-11-09 22:41:15 UTC --- (In reply to comment #26) Another way that fixes the problem mentioned above is to not allow non-float mode operands in the first place. The patch below also fixes the failure, but requires some more work to be complete. A strange thing I've noticed: (define_expand "addsf3" [(set (match_operand:SF 0 "arith_reg_operand" "") (plus:SF (match_operand:SF 1 "arith_reg_operand" "") (match_operand:SF 2 "arith_reg_operand" "")))] "TARGET_SH2E || TARGET_SHMEDIA_FPU" It seems there should be a prefix "fp_" in the operand predicate names. Anyway .. Index: gcc/config/sh/predicates.md =================================================================== --- gcc/config/sh/predicates.md (revision 193342) +++ gcc/config/sh/predicates.md (working copy) @@ -319,16 +319,23 @@ if (register_operand (op, mode)) { int regno; + machine_mode m; if (REG_P (op)) - regno = REGNO (op); + { + regno = REGNO (op); + m = GET_MODE (op); + } else if (GET_CODE (op) == SUBREG && REG_P (SUBREG_REG (op))) - regno = REGNO (SUBREG_REG (op)); + { + regno = REGNO (SUBREG_REG (op)); + m = GET_MODE (SUBREG_REG (op)); + } else return 1; - return (regno >= FIRST_PSEUDO_REGISTER - || FP_REGISTER_P (regno)); + return (regno >= FIRST_PSEUDO_REGISTER || FP_REGISTER_P (regno)) + && GET_MODE_CLASS (m) == MODE_FLOAT; } return 0; }) Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 193342) +++ gcc/config/sh/sh.c (working copy) @@ -876,7 +876,7 @@ if ((flag_pic && ! TARGET_PREFERGOT) || (TARGET_SHMEDIA && !TARGET_PT_FIXED)) flag_no_function_cse = 1; - +#if 0 if (targetm.small_register_classes_for_mode_p (VOIDmode)) \ { /* Never run scheduling before reload, since that can @@ -903,6 +903,7 @@ && !global_options_set.x_flag_schedule_insns) flag_schedule_insns = 0; } +#endif /* Unwind info is not correct around the CFG unless either a frame pointer is present or M_A_O_A is set. Fixing this requires rewriting @@ -10069,6 +10070,9 @@ void expand_sf_binop (rtx (*fun) (rtx, rtx, rtx, rtx), rtx *operands) { + operands[0] = force_reg (SFmode, operands[0]); + operands[1] = force_reg (SFmode, operands[1]); + operands[2] = force_reg (SFmode, operands[2]); emit_sf_insn ((*fun) (operands[0], operands[1], operands[2], get_fpscr_rtx ())); }