patch: 3.4-e500: fix emit_move_insn_1

Aldy Hernandez aldyh@redhat.com
Thu Jan 27 22:17:00 GMT 2005


This is a kludge to fix calls to simplify_gen_subreg that disregard their
return value.  Richard had a much cleaner version in his fix to
PR rtl-opt/15289, but the patch was too intrusive for me to back-port
(ok, I'm also lazy).

This patch brings down the regressions on the branch to equal those of
mainline, actually less.  Neat-o...

Tested on powerpc-eabispe --with-e500_double.

	* expr.c (emit_move_insn_1): Kludge it so failures to
	simplify_gen_subreg are handled gracefully.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.615.4.14.4.5
diff -c -p -r1.615.4.14.4.5 expr.c
*** expr.c	19 Jan 2005 23:38:18 -0000	1.615.4.14.4.5
--- expr.c	27 Jan 2005 22:12:23 -0000
*************** emit_move_insn_1 (rtx x, rtx y)
*** 3122,3135 ****
    else if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
  	   && (submode = int_mode_for_mode (mode)) != BLKmode
  	   && mov_optab->handlers[submode].insn_code != CODE_FOR_nothing)
!     return emit_insn (GEN_FCN (mov_optab->handlers[submode].insn_code)
! 		      (simplify_gen_subreg (submode, x, mode, 0),
! 		       simplify_gen_subreg (submode, y, mode, 0)));
  
    /* This will handle any multi-word or full-word mode that lacks a move_insn
       pattern.  However, you will get better code if you define such patterns,
       even if they must turn into multiple assembler instructions.  */
!   else if (GET_MODE_SIZE (mode) >= UNITS_PER_WORD)
      {
        rtx last_insn = 0;
        rtx seq, inner;
--- 3122,3144 ----
    else if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
  	   && (submode = int_mode_for_mode (mode)) != BLKmode
  	   && mov_optab->handlers[submode].insn_code != CODE_FOR_nothing)
!     {
!       rtx sub1 = simplify_gen_subreg (submode, x, mode, 0),
! 	sub2 = simplify_gen_subreg (submode, y, mode, 0);
! 
!       if (sub1 == NULL_RTX || sub2 == NULL_RTX)
! 	goto multi_word_move;
!       return emit_insn (GEN_FCN (mov_optab->handlers[submode].insn_code)
! 			(sub1, sub2));
!     }
  
    /* This will handle any multi-word or full-word mode that lacks a move_insn
       pattern.  However, you will get better code if you define such patterns,
       even if they must turn into multiple assembler instructions.  */
!   else
!     {
!     multi_word_move:
!     if (GET_MODE_SIZE (mode) >= UNITS_PER_WORD)
      {
        rtx last_insn = 0;
        rtx seq, inner;
*************** emit_move_insn_1 (rtx x, rtx y)
*** 3233,3240 ****
  
        return last_insn;
      }
!   else
!     abort ();
  }
  
  /* If Y is representable exactly in a narrower mode, and the target can
--- 3242,3248 ----
  
        return last_insn;
      }
!     else abort (); }
  }
  
  /* If Y is representable exactly in a narrower mode, and the target can



More information about the Gcc-patches mailing list