[GHC] #13629: sqrt should use machine instruction on x86_64

GHC ghc-devs at haskell.org
Sun Apr 30 17:57:13 UTC 2017


#13629: sqrt should use machine instruction on x86_64
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler (NCG)    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Runtime           |            Test Case:
  performance bug                    |  numeric/num009
      Blocked By:                    |             Blocking:
 Related Tickets:  #13570            |  Differential Rev(s):  Phab:D3508
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by kavon):

 The verbose lowering of sqrt that was there before this patch must have
 stumbled upon some sort of lucky interaction in the processor (arithmetic
 vs memory unit ports) in that particular hot patch of code in n-body,
 which is not something that can be relied on in the grand scheme of
 things.

 What we ''can'' tell is that this patch produces better code, more closely
 matching what LLVM produces as well. bgamari has also kindly quantified
 how much better it is.

 Thus, I think this ~4% drop in n-body is not something to worry about, as
 it seems even non-functional changes can knock a few nofib runtime numbers
 by that amount [1]. Ticket #13570 is also a separate issue: I noticed the
 poor sqrt lowering when I was investigating that ticket.

 [1]
 https://perf.haskell.org/ghc/#revision/945c45ad50ed31e3acb96fdaafb21640c4669f12

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13629#comment:20>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list