Opened 13 months ago

#15580 new task

Specialize min/max functions for GHC provided instances.

Reported by: AndreasK Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.4.3
Keywords: CodeGen Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

In particular for Int/Word/Float/Double we should aim to provide branchless code where reasonable.

Especially when using SSE we should just use minss instead of

  ucomisd %xmm1,%xmm0
  jp .Lc5vv
  jbe .Lc5vw

which is worse in all kinds of ways.

If someone feels like tackling this I'm happy to help with code review, answering questions, etc.

I won't get around to doing it myself any time soon.

As a starting point the instance declarations are in ghc-prim/GHC/Classes.hs.

I would look into solving this via adding a new MachOP/PrimOP but maybe there are even better ways.

Change History (0)

Note: See TracTickets for help on using tickets.