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

GHC ghc-devs at haskell.org
Mon Jul 27 06:46:36 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 simonpj):

 Wait!

 I believe that you are saying that
 {{{
  case na# ==# nb# of
     0# -> e1
     _  -> e2
 }}}
 generates much worse code than
 {{{
   case isTrue# (na# ==# nb#) of
     False -> e1
     True  -> e2
 }}}
 even though the former appears more primitive.  This is all very odd and
 either deserves to be fixed, or at least documented somewhere prominent!

 Where would be a good place to document it?  Perhaps with the primops for
 `(==)#`, `(>=)#`, etc?  Or with `isTrue#`?  And we need a ticket to say
 "let's fix this".

 Speaking of which do you know why it behaves so badly?

 Just changing the code is leaving land-mines for future generations :-).

 Simon

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


More information about the ghc-tickets mailing list