[GHC] #8311: suboptimal code generated for even :: Int -> Bool by NCG (x86, x86_64)

GHC ghc-devs
Fri Oct 4 14:28:12 UTC 2013


#8311: suboptimal code generated for even :: Int -> Bool by NCG (x86, x86_64)
-------------------------------------+------------------------------------
        Reporter:  rwbarton          |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler (NCG)    |          Version:  7.7
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by rwbarton):

 The source of that code is in GHC.Real in base, but for reproducing, use
 this:
 {{{
 module Even where
 myEven :: Int -> Bool
 myEven n = n `rem` 2 == 0
 }}}
 compiled with `ghc -O2 -o Even.o -c Even.hs`.

 The LLVM backend (`ghc -O2 -fllvm -o Even.o -c Even.hs`) does produce a
 `testb  $0x1,0x3(%esi)` instruction.

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



More information about the ghc-tickets mailing list