public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60863] New: Incorrect codegen in ix86_expand_clear for -Os
@ 2014-04-16 15:44 hjl.tools at gmail dot com
  2014-04-16 17:43 ` [Bug target/60863] " ubizjak at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2014-04-16 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60863
           Summary: Incorrect codegen in ix86_expand_clear for -Os
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com

ix86_expand_clear has

  /* This predicate should match that for movsi_xor and movdi_xor_rex64.  */
  if (!TARGET_USE_MOV0 || optimize_insn_for_speed_p ())
    {
      rtx clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
      tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
    }

But "xor reg,reg" has shorter encoding than "mov $0, reg".  If
"xor reg,reg" is generated for -O, shouldn't it also be generated
for -Os?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/60863] Incorrect codegen in ix86_expand_clear for -Os
  2014-04-16 15:44 [Bug target/60863] New: Incorrect codegen in ix86_expand_clear for -Os hjl.tools at gmail dot com
@ 2014-04-16 17:43 ` ubizjak at gmail dot com
  2014-04-17 15:20 ` hjl at gcc dot gnu.org
  2014-04-17 15:21 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2014-04-16 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to H.J. Lu from comment #0)
> ix86_expand_clear has
> 
>   /* This predicate should match that for movsi_xor and movdi_xor_rex64.  */
>   if (!TARGET_USE_MOV0 || optimize_insn_for_speed_p ())
>     {
>       rtx clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
>       tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
>     }
> 
> But "xor reg,reg" has shorter encoding than "mov $0, reg".  If
> "xor reg,reg" is generated for -O, shouldn't it also be generated
> for -Os?

This is a typo, the condition should be optimize_insn_for_size_p. Just look
peepholes in i386.md after "Attempt to always use XOR for zeroing registers."
comment.

The patch that fixes the condition is preapproved - please also remove outdated
comment about predicates.
>From gcc-bugs-return-449187-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 16 18:05:46 2014
Return-Path: <gcc-bugs-return-449187-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8870 invoked by alias); 16 Apr 2014 18:05:46 -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 8824 invoked by uid 48); 16 Apr 2014 18:05:40 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/60256] No -Wuninitialized warning for strcpy
Date: Wed, 16 Apr 2014 18:05: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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
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-60256-4-JSI6UoWzWs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60256-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60256-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: 2014-04/txt/msg01207.txt.bz2
Content-length: 630

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`256

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We call c_fully_fold on strcpy (s, s);, and because this CALL_EXPR is
tcc_vl_exp, we call fold () on it.  fold () then via fold_call_expr -> ...
calls fold_builtin_strcpy and that hits
  /* If SRC and DEST are the same (and not volatile), return DEST.  */
  if (operand_equal_p (src, dest, 0))
    return fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fndecl)), dest);

But on second thought, delayed folding won't help, as uninit passes are run
quite late and at that point strcpy(s, s); will be already gone.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/60863] Incorrect codegen in ix86_expand_clear for -Os
  2014-04-16 15:44 [Bug target/60863] New: Incorrect codegen in ix86_expand_clear for -Os hjl.tools at gmail dot com
  2014-04-16 17:43 ` [Bug target/60863] " ubizjak at gmail dot com
@ 2014-04-17 15:20 ` hjl at gcc dot gnu.org
  2014-04-17 15:21 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-04-17 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Thu Apr 17 15:19:34 2014
New Revision: 209488

URL: http://gcc.gnu.org/viewcvs?rev=209488&root=gcc&view=rev
Log:
Generate "xor reg, reg" if optimizing for size

    PR target/60863
    * config/i386/i386.c (ix86_expand_clear): Remove outdated
    comment.  Check optimize_insn_for_size_p instead of
    optimize_insn_for_speed_p.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/60863] Incorrect codegen in ix86_expand_clear for -Os
  2014-04-16 15:44 [Bug target/60863] New: Incorrect codegen in ix86_expand_clear for -Os hjl.tools at gmail dot com
  2014-04-16 17:43 ` [Bug target/60863] " ubizjak at gmail dot com
  2014-04-17 15:20 ` hjl at gcc dot gnu.org
@ 2014-04-17 15:21 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2014-04-17 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-17 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-16 15:44 [Bug target/60863] New: Incorrect codegen in ix86_expand_clear for -Os hjl.tools at gmail dot com
2014-04-16 17:43 ` [Bug target/60863] " ubizjak at gmail dot com
2014-04-17 15:20 ` hjl at gcc dot gnu.org
2014-04-17 15:21 ` hjl.tools at gmail dot com

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).