public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/37633]  New: [4.4 Regression] wrong register use on sh64
@ 2008-09-24  1:12 kkojima at gcc dot gnu dot org
  2010-04-30  9:25 ` [Bug target/37633] [4.4/4.5/4.6 " jakub at gcc dot gnu dot org
  0 siblings, 1 reply; 12+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2008-09-24  1:12 UTC (permalink / raw)
  To: gcc-bugs

Currently many tests for string builtin functions fail on
sh64-unknown-linux-gnu.  Here is a small test case:

extern void abort (void);

char buf[64];

int
main (void)
{
  __builtin_strcpy (buf, "mystring");
  if (strcmp (buf, "mystring") != 0)
    abort ();

  __builtin_strcpy (buf, "mystring");
  if (strcmp (buf, "mystring") != 0)
    abort ();

  return 0;
}

With -O3, the register R11 is used to hold 8-byte of "mystring"
for the first __builtin_strcpy call.  The value in R11 is reused
with the 2nd __builtin_strcpy call.
When strcmp is dynamically linked, the upper 32-bit of R11 is
clobbered by the first call of strcmp.  Then the 2nd strcmp
returns false.
The backend defines HARD_REGNO_CALL_PART_CLOBBERED so to notify
that the upper 32-bit of R11 may be clobbered for SHmedia:

/* Only the lower 32-bits of R10-R14 are guaranteed to be preserved
   across SHcompact function calls.  We can't tell whether a called
   function is SHmedia or SHcompact, so we assume it may be when
   compiling SHmedia code with the 32-bit ABI, since that's the only
   ABI that can be linked with SHcompact code.  */
#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) \
  (TARGET_SHMEDIA32 \
   && GET_MODE_SIZE (MODE) > 4 \
   && (((REGNO) >= FIRST_GENERAL_REG + 10 \
        && (REGNO) <= FIRST_GENERAL_REG + 15) \
       || TARGET_REGISTER_P (REGNO) \
       || (REGNO) == PR_MEDIA_REG))

but it seems that now HARD_REGNO_CALL_PART_CLOBBERED doesn't affect
the register allocation.


-- 
           Summary: [4.4 Regression] wrong register use on sh64
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kkojima at gcc dot gnu dot org
GCC target triplet: sh64-unknow-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37633


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-09-21  8:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37633-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:49 ` [Bug target/37633] [4.4/4.5/4.6 Regression] wrong register use on sh64 jakub at gcc dot gnu.org
2011-04-16 10:30 ` [Bug target/37633] [4.4/4.5/4.6/4.7 " jakub at gcc dot gnu.org
2012-03-13 13:02 ` [Bug target/37633] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-07-02 12:49 ` [Bug target/37633] [4.6/4.7/4.8 " rguenth at gcc dot gnu.org
2013-04-12 15:15 ` [Bug target/37633] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-06-12 13:43 ` [Bug target/37633] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:24 ` [Bug target/37633] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-23  8:13 ` [Bug target/37633] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:51 ` [Bug target/37633] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:29 ` jakub at gcc dot gnu.org
2015-09-21  8:19 ` olegendo at gcc dot gnu.org
2008-09-24  1:12 [Bug target/37633] New: [4.4 " kkojima at gcc dot gnu dot org
2010-04-30  9:25 ` [Bug target/37633] [4.4/4.5/4.6 " jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).