public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/46942] x86_64 parameter passing unnecessary sign/zero extends
Date: Tue, 14 Dec 2010 17:13:00 -0000	[thread overview]
Message-ID: <bug-46942-4-QBWPq2KVYK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46942-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-14 17:13:19 UTC ---
__attribute__((noinline, noclone))
unsigned long f1 (unsigned int a, int b, unsigned short c, short d, unsigned
char e, signed char f)
{
  return (unsigned long) a + b + c + d + e + f;
}

unsigned long l;

unsigned long f2 (void)
{
  return f1 (l + 41, l + 41, l + 41, l + 41, l + 41, l + 41) + 1;
}

unsigned long f3 (unsigned int a, int b, unsigned short c, short d, unsigned
char e, signed char f)
{
  return f1 (a, b, c, d, e, f);
}

unsigned long f4 (int a, unsigned int b, short c, unsigned short d, signed char
e, unsigned char f)
{
  return f1 (a, b, c, d, e, f);
}

at -O2 shows in f4 that we can't trust that the sign/zero extension is done on
the caller side, at least we can't trust that it is sign/zero extended into
64-bits.


  reply	other threads:[~2010-12-14 17:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 16:50 [Bug target/46942] New: " jakub at gcc dot gnu.org
2010-12-14 17:13 ` jakub at gcc dot gnu.org [this message]
2010-12-14 17:26 ` [Bug target/46942] " joseph at codesourcery dot com
2010-12-16 15:12 ` rguenth at gcc dot gnu.org
2011-01-02 17:58 ` hjl.tools at gmail dot com
2011-01-02 17:59 ` hjl.tools at gmail dot com
2011-01-02 19:02 ` jakub at gcc dot gnu.org
2011-01-02 20:53 ` hjl.tools at gmail dot com
2011-01-03 14:23 ` hjl.tools at gmail dot com
2011-03-25 20:06 ` jakub at gcc dot gnu.org
2011-04-28 16:38 ` rguenth at gcc dot gnu.org
2012-03-08  3:42 ` meadori at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46942-4-QBWPq2KVYK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).