public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/89822] self mov on x86_64 and not optimized-out sub on ARM/ARM64 in a jump table switch
       [not found] <bug-89822-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-03  1:32 ` pinskia at gcc dot gnu.org
  2021-08-03  1:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03  1:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89822

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't see anything wrong with what is currently done.

aarch64 cost for a jump table is very high which causes the jump table not be
generated.  indirect jumps on some/most aarch64 cores are not very predictable
so GCC tries to avoid them.

Note with clang, the x86_64 code has:
addl    $-1, %edi
Which is also a zero extend.
GCC is not subtracting one as it was trying to avoid an instruction.
If change the argument type to long, gcc will not produce the zero_extend and
produce better code than clang (the table size one element bigger but does that
matter I doubt it).

If you add 100 to each of the case statements (and change the type to long),
gcc still produces better code than clang:
        jmp     *.L4-808(,%rdi,8)
vs
        addq    $-101, %rdi
        jmpq    *.LJTI0_0(,%rdi,8)

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

* [Bug target/89822] self mov on x86_64 and not optimized-out sub on ARM/ARM64 in a jump table switch
       [not found] <bug-89822-4@http.gcc.gnu.org/bugzilla/>
  2021-08-03  1:32 ` [Bug target/89822] self mov on x86_64 and not optimized-out sub on ARM/ARM64 in a jump table switch pinskia at gcc dot gnu.org
@ 2021-08-03  1:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03  1:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89822

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh the sub issue for aarch64 is solved in GCC 7+.

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

end of thread, other threads:[~2021-08-03  1:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89822-4@http.gcc.gnu.org/bugzilla/>
2021-08-03  1:32 ` [Bug target/89822] self mov on x86_64 and not optimized-out sub on ARM/ARM64 in a jump table switch pinskia at gcc dot gnu.org
2021-08-03  1:34 ` pinskia at gcc dot gnu.org

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