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]

MIPS bug fix for Broadcom SB-1A


Trying to generate mips-linux O32 SB-1A code fails with an ICE in
store_data_bypass_p.  The problem is that the linux O32 support is still
using a cprestore pattern that uses an UNSPEC_VOLATILE, and which has an
instruction type of store.  This causes it to be passed to the
store_data_bypass_p function, which then calls abort because it can't
find the store address.  The prev insn that caused this is the
instruction that adjusts the stack pointer downwards before the
cprestore.

This failure does not happen for the SB-1 port, because the
ir_simple_sb1_alu pattern does not appear in a bypass that uses
store_data_bypass_p.  The ir_simple_sb1a_alu pattern however does.

There are a number of possible solutions here.  I chose a simple one.  I
added a mips_store_data_bypass_p function that handles cprestore, and
then passes all other insns off to the standard store_data_bypass_p
function.  While working on this, I noticed that I accidentally got the
sense of the tests wrong.  I had the sense right in my original patch
that added my own store address check function, but when I modified it
to use the standard store_data_bypass_p I missed the fact that it was
doing something slightly different.  So I fixed this also in this patch.

There are also other possible solutions.  The cprestore pattern could be
modified to stop using an UNSPEC_VOLATILE.  I'm not sure what the effect
of doing that would be though.  The mips_store_data_bypass_p function is
safer.  We could fix the standard store_data_bypass_p function to handle
cprestore, but it seems wrong to let mips backend cruft leak into the
recog.c file.

Just now while writing this up, I noticed that the 24k.md DFA scheduler
has yet another solution.  It adds a special pattern to match the
cprestore pattern, so it won't end up matching the bypass pattern.  This
seems somewhat reasonable, except it means all affected DFA schedulers
have to have a special cprestore pattern.  My approach means that we can
modify them all to use mips_store_data_bypass_p, and no special DFA
sched patterns are needed.

Comments?  I am willing to adopt whatever solution people think is best.

As with the previous patch, this was tested with a mips-linux O32
--with-{arch,tune}=sb1a C and C++ bootstrap and make check.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com

Attachment: patch.cprestore
Description: Text document


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