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

            Bug ID: 99228
           Summary: blend/shuffle
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g.peterh...@t-online.de
  Target Milestone: ---

Hello ggc team,
the compiler generates very inefficient code for the sgn functions (scalar and
complex arguments)
https://godbolt.org/z/zvE3Mf

scalar
- float32/64: 2 conditional jumps instead of blend/shuffle
- float80: no fcmov
- integer: only cmov instead of blend/shuffle

complex
- float32/64: 4 conditional jumps instead of blend/shuffle
- float80: no fcmov
- integer: only cmov instead of blend/shuffle

For testing I have 3 versions each:
v1: total disaster
v2: better, only half of the jumps each time, but clang can't really handle
that
v3: like v2, but clang seems to work too. If you remove [[likely]] from
conditional_move like v1.

regards
Gero

Reply via email to