public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59615] "asm goto" output or at least clobbered operands
Date: Sat, 28 Dec 2013 10:29:00 -0000	[thread overview]
Message-ID: <bug-59615-4-dbPquQKr7l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59615-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Looking at the assembly, you probably want:

--cut here--
int test (int a, int b, int c)
{
  unsigned r = a + b;

  if (r < (unsigned) a)
    return 1;
  else if (r > c)
    return 1;

  return 0;
}
--cut here--

gcc-4.8.2 -O2:

test:
        addl    %esi, %edi
        movl    $1, %eax
        jc      .L2
        xorl    %eax, %eax
        cmpl    %edx, %edi
        seta    %al
.L2:
        rep ret

Please note how the compiler is able to generate jc without compare insn.
>From gcc-bugs-return-438636-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Dec 28 10:38:30 2013
Return-Path: <gcc-bugs-return-438636-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8421 invoked by alias); 28 Dec 2013 10:38:30 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 8385 invoked by uid 48); 28 Dec 2013 10:38:26 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59615] "asm goto" output or at least clobbered operands
Date: Sat, 28 Dec 2013 10:38:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59615-4-GDpj5JkGtR@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59615-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59615-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-12/txt/msg02291.txt.bz2
Content-length: 263

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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #2)

>   if (r < (unsigned) a)

Explicit cast is not needed here, the compiler will do it for you.
>From gcc-bugs-return-438637-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Dec 28 10:39:21 2013
Return-Path: <gcc-bugs-return-438637-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9184 invoked by alias); 28 Dec 2013 10:39:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 9155 invoked by uid 48); 28 Dec 2013 10:39:17 -0000
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59604] Constant comparisons with -fno-range-check and int(z'...')
Date: Sat, 28 Dec 2013 10:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tkoenig at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: tkoenig at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on assigned_to everconfirmed
Message-ID: <bug-59604-4-Vj0qPXgwjt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59604-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59604-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-12/txt/msg02292.txt.bz2
Content-length: 573

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY604

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-12-28
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I have a patch.


  parent reply	other threads:[~2013-12-28 10:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-28  0:23 [Bug c/59615] New: " hpa at zytor dot com
2013-12-28  8:42 ` [Bug c/59615] " jakub at gcc dot gnu.org
2013-12-28 10:29 ` ubizjak at gmail dot com [this message]
2013-12-28 16:28 ` jakub at gcc dot gnu.org
2013-12-30  1:37 ` hpa at zytor dot com
2013-12-30 17:53 ` glisse at gcc dot gnu.org
2013-12-30 17:56 ` jakub at gcc dot gnu.org
2013-12-30 18:17 ` glisse at gcc dot gnu.org
2021-09-01  1:05 ` [Bug inline-asm/59615] " pinskia at gcc dot gnu.org

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-59615-4-dbPquQKr7l@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).