#5422: Panic when using lots of registers in cmm code
---------------------------------+------------------------------------------
    Reporter:  pumpkin           |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.2.1       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by ekmett):

 Yes. For a concrete example, calling MPFR's 'add' function in the style of
 our use of GMP would take 9.

 {{{
 type CSign#      = Int#
 type CPrecision# = Int#
 type CExp#       = Int#
 type CRounding#  = Int#

 foreign import prim "mpfr_cmm_add" mpfrAdd#
   :: CRounding#
   -> CPrecision# -> CSign# -> CExp# -> ByteArray#
   -> CPrecision# -> CSign# -> CExp# -> ByteArray#
   -> (# CPrecision#, CSign#, CExp#, ByteArray# #)
 }}}

 As a stopgap, we are multiplying sign by precision a priori and unpacking
 in C--.

 {{{
 type CSignPrec# = Int#

 foreign import prim "mpfr_cmm_add" mpfrAdd#
   :: CRounding#
   -> CSignPrec# -> CExp# -> ByteArray#
   -> CSignPrec# -> CExp# -> ByteArray#
   -> (# CSignPrec#, CExp#, ByteArray# #)
 }}}

 This gets us down to 7 for most ops, in exchange for a bunch of random bit
 twiddling, but there are some bindings that will still push us up against
 the limit.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to