This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix SPE prologue


I've applied this obvious fix for an SPE prologue problem. We were generating offsets relative to $sp, which is not correct when there's a frame pointer. We should be unconditionally using frame_reg_rtx, which will either be r1 or r12 as appropriate. Here's the assembly we get for a reduced compile/920501-4.i testcase with -O1 -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe -fPIC.

without patch:
        mr 12,1
        lis 0,0xffff
        ori 0,0,32744
        stwux 1,1,0
        mflr 0
        stw 0,4(12)
        addi 11,1,-24 <-- 24 bytes below stack pointer
        evstdd 30,0(11)

with patch:
        mr 12,1
        lis 0,0xffff
        ori 0,0,32744
        stwux 1,1,0
        mflr 0
        stw 0,4(12)
        addi 11,12,-24  <-- 24 bytes below frame pointer
        evstdd 30,0(11)

Epilogue generation was already correct.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery

2007-12-11  Nathan Sidwell  <nathan@codesourcery.com>

	* config/rs6000/rs6000.c (rs6000_emit_prologue): Use frame_reg_rtx
	for SPE saves.

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 130773)
+++ config/rs6000/rs6000.c	(working copy)
@@ -15694,7 +15694,7 @@ rs6000_emit_prologue (void)
  
        if (spe_regs_addressable_via_sp)
          {
-           spe_save_area_ptr = sp_reg_rtx;
+           spe_save_area_ptr = frame_reg_rtx;
            spe_offset = info->spe_gp_save_offset + sp_offset;
          }
        else
@@ -15715,7 +15715,7 @@ rs6000_emit_prologue (void)
              }
  
            spe_save_area_ptr = gen_rtx_REG (Pmode, 11);
-           emit_insn (gen_addsi3 (spe_save_area_ptr, sp_reg_rtx,
+           emit_insn (gen_addsi3 (spe_save_area_ptr, frame_reg_rtx,
                                   GEN_INT (info->spe_gp_save_offset + sp_offset)));
  
            spe_offset = 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]