Patchwork Fix RTL checking failure in return value code

login
register
mail settings
Submitter Eric Botcazou
Date March 23, 2013, 11:12 a.m.
Message ID <2834233.Zd8GdLaxtA@polaris>
Download mbox | patch
Permalink /patch/230325/
State New
Headers show

Comments

Eric Botcazou - March 23, 2013, 11:12 a.m.
We ran into RTL checking failure on the 4.7 branch for ARM (BE/VFPv3/ARM):

FAIL: gcc.c-torture/execute/vector-subscript-1.c compilation,  -O0  (internal 
compiler error)
UNRESOLVED: gcc.c-torture/execute/vector-subscript-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/vector-subscript-2.c compilation,  -O0  (internal 
compiler error)
UNRESOLVED: gcc.c-torture/execute/vector-subscript-2.c execution,  -O0 

The code in expand_function_end:

          /* If a non-BLKmode return value should be padded at the least
             significant end of the register, shift it left by the appropriate
             amount.  BLKmode results are handled using the group load/store
             machinery.  */
          if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode
              && targetm.calls.return_in_msb (TREE_TYPE (decl_result)))
            {
              emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),
                                           REGNO (real_decl_rtl)),
                              decl_rtl);
              shift_return_value (GET_MODE (decl_rtl), true, real_decl_rtl);
            }

is taking REGNO of a PARALLEL:

(parallel/i:TI [
        (expr_list:REG_DEP_TRUE (reg:DI 63 s0)
            (const_int 0 [0]))
        (expr_list:REG_DEP_TRUE (reg:DI 65 s2)
            (const_int 8 [0x8]))
    ])


Fixed thusly, tested on x86_64-suse-linux, applied on the mainline as obvious.


2013-03-23  Eric Botcazou  <ebotcazou@adacore.com>

	* calls.c (expand_call): Add missing guard to code handling return
	of non-BLKmode structures in MSB.
	* function.c (expand_function_end): Likewise.

Patch

Index: calls.c
===================================================================
--- calls.c	(revision 196816)
+++ calls.c	(working copy)
@@ -3171,7 +3171,9 @@  expand_call (tree exp, rtx target, int i
 	 group load/store machinery below.  */
       if (!structure_value_addr
 	  && !pcc_struct_value
+	  && TYPE_MODE (rettype) != VOIDmode
 	  && TYPE_MODE (rettype) != BLKmode
+	  && REG_P (valreg)
 	  && targetm.calls.return_in_msb (rettype))
 	{
 	  if (shift_return_value (TYPE_MODE (rettype), false, valreg))
Index: function.c
===================================================================
--- function.c	(revision 196816)
+++ function.c	(working copy)
@@ -5093,6 +5093,7 @@  expand_function_end (void)
 	     amount.  BLKmode results are handled using the group load/store
 	     machinery.  */
 	  if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode
+	      && REG_P (real_decl_rtl)
 	      && targetm.calls.return_in_msb (TREE_TYPE (decl_result)))
 	    {
 	      emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),