public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Georg-Johann Lay <avr@gjlay.de>
To: Michael Walle <michael@walle.cc>
Cc: gcc@gcc.gnu.org
Subject: Re: libgcc: strange optimization
Date: Mon, 01 Aug 2011 20:51:00 -0000	[thread overview]
Message-ID: <4E37116F.1050608@gjlay.de> (raw)
In-Reply-To: <201108012230.29989.michael@walle.cc>

Michael Walle schrieb:
> Hi list,
> 
> consider the following test code:
>  static void inline f1(int arg)
>  {
>    register int a1 asm("r8") = 10;
>    register int a2 asm("r1") = arg;
> 
>    asm("scall" : : "r"(a1), "r"(a2));
>  }
> 
>  void f2(int arg)
>  {
>    f1(arg >> 10);
>  }
> 
> 
> If you compile this code with 'lm32-gcc -O1 -S -c test.c' (see end of this
> email), the a1 = 10; assignment is optimized away.

Your asm has no output operands and no side effects, with more 
aggressive optimization the whole ask would disappear.

What you want is maybe something like

    asm volatile ("scall" : : "r"(a1), "r"(a2));

Johann

  reply	other threads:[~2011-08-01 20:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 20:30 Michael Walle
2011-08-01 20:51 ` Georg-Johann Lay [this message]
2011-08-01 21:14   ` Michael Walle
2011-08-02  6:47     ` Georg-Johann Lay
2011-08-02  6:29   ` Hans-Peter Nilsson
2011-08-01 21:30 ` Richard Henderson
2011-08-02  6:37   ` Hans-Peter Nilsson
2011-08-02  8:49     ` Mikael Pettersson
2011-08-02  9:47       ` Richard Guenther
2011-08-02 10:02         ` Georg-Johann Lay
2011-08-02 10:11           ` Richard Guenther
2011-08-02 10:55             ` Michael Walle
2011-08-02 12:06               ` Mikael Pettersson
2011-08-02 12:23                 ` Richard Guenther
2011-08-02 12:36                   ` Georg-Johann Lay
2011-08-02 12:54                   ` Hans-Peter Nilsson
2011-08-02 13:09                     ` Richard Guenther
2011-08-02 13:16                       ` Hans-Peter Nilsson
2011-08-03  4:59                       ` Miles Bader
2011-08-02 13:23                   ` Ian Lance Taylor
2011-08-02 13:42                     ` Richard Guenther
2011-08-02 14:35                       ` Ian Lance Taylor
2011-08-03  9:12                       ` Ulrich Weigand
2011-08-03  9:51                         ` Georg-Johann Lay
2011-08-03 10:04                           ` Richard Guenther
2011-08-03 13:27                             ` Michael Matz
2011-08-03 14:02                               ` Richard Guenther
2011-08-03 14:55                                 ` Georg-Johann Lay
2011-08-03 15:05                                 ` Richard Henderson
2011-08-04  0:20                         ` Hans-Peter Nilsson
2011-08-04  7:29                           ` Andreas Schwab
2011-08-04 13:04                             ` Hans-Peter Nilsson
2011-08-04  9:51                           ` Andrew Haley
2011-08-04  9:52                             ` Richard Guenther
2011-08-04 11:11                               ` Andrew Haley
2011-08-04 11:20                                 ` Richard Guenther
2011-08-04 14:46                                   ` Andrew Haley
2011-08-06 15:00                                 ` Paolo Bonzini
2011-08-08  8:06                                   ` Richard Guenther
2011-08-08 10:59                                     ` Paolo Bonzini
2011-08-02 16:03                   ` Richard Henderson
2011-08-02 20:10                     ` Richard Guenther
2011-08-02 17:21                   ` Georg-Johann Lay
2011-08-09 16:55                   ` Richard Earnshaw
2011-08-09 17:24                     ` Ulrich Weigand
2011-08-09 19:48                       ` Hans-Peter Nilsson
2011-08-10  0:40                     ` Hans-Peter Nilsson

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=4E37116F.1050608@gjlay.de \
    --to=avr@gjlay.de \
    --cc=gcc@gcc.gnu.org \
    --cc=michael@walle.cc \
    /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).