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 rtl-optimization/31799] Failed to optimize out test instruction
Date: Thu, 03 May 2007 16:08:00 -0000 [thread overview]
Message-ID: <20070503160841.18687.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31799-682@http.gcc.gnu.org/bugzilla/>
------- Comment #1 from ubizjak at gmail dot com 2007-05-03 17:08 -------
(In reply to comment #0)
> foo:
> addl $1, %edi
> testl %edi, %edi
> movl %edi, (%rdx)
> je .L3
> movl $1, (%rsi)
> .L3:
> rep ; ret
This is just an unfortunate corner case. During combine phase we get:
(insn 10 6 11 2 (parallel [
(set (reg/v:SI 58 [ x.27 ])
(plus:SI (reg/v:SI 59 [ x ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) 210 {*addsi_1} (insn_list:REG_DEP_TRUE 3 (nil))
(expr_list:REG_DEAD (reg/v:SI 59 [ x ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 11 10 13 2 (set (mem:SI (reg/v/f:DI 61 [ z ]) [2 S4 A32])
(reg/v:SI 58 [ x.27 ])) 40 {*movsi_1} (insn_list:REG_DEP_TRUE 5
(insn_list:REG_DEP_TRUE 10 (nil)))
(expr_list:REG_DEAD (reg/v/f:DI 61 [ z ])
(nil)))
(insn 13 11 14 2 (set (reg:CCZ 17 flags)
(compare:CCZ (reg/v:SI 58 [ x.27 ])
(const_int -1 [0xffffffffffffffff]))) 5 {*cmpsi_1_insn} (nil)
(expr_list:REG_DEAD (reg/v:SI 58 [ x.27 ])
(nil)))
It looks that insn 10 and insn 13 don't combine into flags setting insn due to
insn 11 interfering in some way. If the code is changed to:
void
foo (int x, int *y, int *z)
{
if (++x != 0)
*y = 1;
*z = x;
}
then gcc generates expected asm without test insn.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-05-03 17:08:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31799
next prev parent reply other threads:[~2007-05-03 16:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-03 14:21 [Bug rtl-optimization/31799] New: " hjl at lucon dot org
2007-05-03 16:08 ` ubizjak at gmail dot com [this message]
2007-05-03 16:22 ` [Bug rtl-optimization/31799] " ubizjak at gmail dot com
2007-05-05 1:31 ` hjl at lucon dot org
2007-05-05 17:49 ` ubizjak at gmail dot com
[not found] <bug-31799-4@http.gcc.gnu.org/bugzilla/>
2020-08-03 14:00 ` david.bolvansky at gmail dot com
2020-08-03 14:01 ` david.bolvansky at gmail dot com
2020-11-17 10:06 ` gabravier at gmail dot com
2020-11-17 13:57 ` hjl.tools at gmail dot com
2020-11-17 14:05 ` cvs-commit at gcc dot gnu.org
2020-11-17 14:05 ` hjl.tools 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=20070503160841.18687.qmail@sourceware.org \
--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).