This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/70467] Useless "and [esp],-1" emitted on AND with uint64_t variable


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]