public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "konstantin.vladimirov at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/67751] New: redundant zero extension
Date: Mon, 28 Sep 2015 18:05:00 -0000 [thread overview]
Message-ID: <bug-67751-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67751
Bug ID: 67751
Summary: redundant zero extension
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: konstantin.vladimirov at gmail dot com
Target Milestone: ---
Simple test:
---
struct U {
unsigned s: 1;
};
struct V {
unsigned short o: 7;
unsigned short u: 1;
};
extern struct U t[];
extern struct V d[];
unsigned
foo ()
{
struct V descr = d[0];
unsigned osize = descr.o;
if ( descr.u )
{
struct U udata = t[osize];
if (udata.s) osize++;
}
return osize;
}
---
Compiled with specified gcc:
>gcc -v
Using built-in specs.
COLLECT_GCC=/tools/local/gcc-5.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/tools/local/gcc-5.2.0/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.2.0/configure
--prefix=/tools/local/gcc-5.2.0 --program-suffix=-5.2.0
--with-as=/tools/local/binutils-2.24/bin/as
--with-ld=/tools/local/binutils-2.24/bin/ld
Thread model: posix
gcc version 5.2.0 (GCC)
---
with options: -02 -S
---
Yields assembler:
---
foo:
movzbl d(%rip), %eax
andl $127, %eax
cmpb $0, d(%rip)
movzbl %al, %eax // <----- why this is here?
jns .L2
movl %eax, %edx
movl t(,%rdx,4), %edx
andl $1, %edx
cmpb $1, %dl
sbbl $-1, %eax
.L2:
rep ret
---
Second movzbl looks excessive
reply other threads:[~2015-09-28 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-67751-4@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).