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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> In fact I'd say the reverse transformation is more profitable?

In the end it depends on the context. It's a trade-off between a conditional
branch and extra data dependencies feeding into the address of a store. If a
branch is perfectly predictable, it's preferable. Otherwise, if there's no
memory dependency via the store, you don't care about delaying it, making the
branchless version preferable if that reduces pipeline flushes. If there is a
dependency, it comes down to how often the branch mispredicts, I guess.

  ________________________________
 /                                \
| People who tinker with compilers |
| need __builtin_branchless_select |
 \                                /
  ================================
                                     \
                                      \
                                       \
                                        .--.
                                       |o_o |
                                       | ~  |
                                      //   \ \
                                     (|     | )
                                    /'\_   _/`\
                                    \___)=(___/

Reply via email to