This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/70467] Useless "and [esp],-1" emitted on AND with uint64_t variable
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Mar 2016 10:10:26 +0000
- Subject: [Bug rtl-optimization/70467] Useless "and [esp],-1" emitted on AND with uint64_t variable
- Auto-submitted: auto-generated
- References: <bug-70467-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70467
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |jakub at gcc dot gnu.org
Resolution|FIXED |---
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is not fixed, try
-m32 -O2 -mno-sse.
I believe the issue is that we expand_binop DImode
op0 == target
(mem/c:DI (plus:SI (reg/f:SI 82 virtual-stack-vars)
(const_int -16 [0xfffffffffffffff0])) [0 MEM[(char *
{ref-all})&value]+0 S8 A128])
and op1
(const_int 9223372036854775807 [0x7fffffffffffffff])
which then expands this per subwords as two SImode expand_binops, but nothing
there is able to optimize & -1 (and similarly | or ^ 0, or & 0, or | -1).
And, combiner doesn't do anything, because it is a single insn that operates on
memory, so there is nothing to combine together.
So, IMHO expand_binop just should handle the easy cases. I'll prepare a patch.