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
  2008-09-24  1:13 ` [Bug target/37633] " kkojima at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ 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] 18+ messages in thread

end of thread, other threads:[~2010-04-30  8:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24  1:12 [Bug target/37633] New: [4.4 Regression] wrong register use on sh64 kkojima at gcc dot gnu dot org
2008-09-24  1:13 ` [Bug target/37633] " kkojima at gcc dot gnu dot org
2008-09-24  3:11 ` pinskia at gcc dot gnu dot org
2008-09-26  3:32 ` kkojima at gcc dot gnu dot org
2008-10-08 21:56 ` vmakarov at redhat dot com
2008-10-14 19:43 ` vmakarov at redhat dot com
2008-10-14 22:26 ` hjl at gcc dot gnu dot org
2008-10-15 23:16 ` kkojima at gcc dot gnu dot org
2008-10-16  0:55 ` vmakarov at gcc dot gnu dot org
2008-10-21 23:43 ` kkojima at gcc dot gnu dot org
2009-01-02 17:17 ` andreasmeier80 at gmx dot de
2009-01-02 22:52 ` kkojima at gcc dot gnu dot org
2009-03-08 16:35 ` amylaar at gcc dot gnu dot org
2009-04-21 15:59 ` [Bug target/37633] [4.4/4.5 " jakub at gcc dot gnu dot org
2009-07-22 10:34 ` jakub at gcc dot gnu dot org
2009-10-15 12:55 ` jakub at gcc dot gnu dot org
2010-01-21 13:19 ` jakub 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).