[GHC] #10676: silly assembly for comparing the result of comparisons that return Int# against 0#

GHC ghc-devs at haskell.org
Sun Jul 26 03:34:18 UTC 2015


#10676: silly assembly for comparing the result of comparisons that return Int#
against 0#
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                   Owner:
            Type:  bug               |                  Status:  closed
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
  (CodeGen)                          |
      Resolution:  duplicate         |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:  #8326, #8327      |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by Reid Barton <rwbarton@…>):

 In [changeset:"7e70c063ad88052ca5f2586eb07e5d1571956acd/ghc"
 7e70c063/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="7e70c063ad88052ca5f2586eb07e5d1571956acd"
 Use isTrue# around primitive comparisons in integer-gmp

 Summary:
 The form
   case na# ==# nb# of
     0# -> ...
     _  -> ...
 sometimes generates convoluted assembly, see #10676.
 timesInt2Integer was the most spectacular offender, especially as
 it is a rather cheap function overall (no calls to gmp).

 I checked a few instances and some of the old generated assembly
 was fine already, but I changed them all for consistency. The new
 form is also more consistent with use of these primops in general.

 Test Plan: validate

 Reviewers: hvr, bgamari, goldfire, austin

 Reviewed By: hvr

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D1094
 }}}

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


More information about the ghc-tickets mailing list