[GHC] #9431: integer-gmp small Integer multiplication does two multiplications on x86

GHC ghc-devs at haskell.org
Thu Nov 13 02:00:24 UTC 2014


#9431: integer-gmp small Integer multiplication does two multiplications on x86
-------------------------------------+-------------------------------------
              Reporter:  rwbarton    |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.9
             Component:  Compiler    |         Keywords:
  (NCG)                              |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:  Runtime     |
  performance bug                    |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * cc: simonmar (added)
 * failure:  None/Unknown => Runtime performance bug
 * component:  Compiler => Compiler (NCG)


Comment:

 For reference, from `libraries/integer-gmp2/src/GHC/Integer/Type.hs`:
 {{{#!haskell
 -- | Multiply two 'Integer's
  timesInteger :: Integer -> Integer -> Integer
  timesInteger _       (S# 0#) = S# 0#
  timesInteger (S# 0#) _       = S# 0#
  timesInteger x       (S# 1#) = x
  timesInteger (S# 1#) y       = y
  timesInteger x      (S# -1#) = negateInteger x
  timesInteger (S# -1#) y      = negateInteger y
  timesInteger (S# x#) (S# y#)
    = case mulIntMayOflo# x# y# of
      0# -> S# (x# *# y#)
      _  -> timesInt2Integer x# y#
 }}}

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


More information about the ghc-tickets mailing list