1. 19 Jun, 2008 2 commits
  2. 16 Jun, 2008 2 commits
  3. 15 Jun, 2008 1 commit
  4. 13 Jun, 2008 2 commits
  5. 02 Jan, 2008 2 commits
  6. 18 Dec, 2007 1 commit
  7. 01 Jun, 2008 1 commit
    • Ian Lynagh's avatar
      Tweak the definition of (^) again · 20fb7a8e
      Ian Lynagh authored
      This fixes trac #2306 (do the minimum number of (*)s), and also means
      that we don't use the value of (1 :: a) which causes problems if the
      Num a definition isn't complete.
      20fb7a8e
  8. 27 May, 2008 1 commit
  9. 20 May, 2008 3 commits
  10. 09 May, 2008 1 commit
    • Simon Marlow's avatar
      Avoid calling varargs functions using the FFI · e6a38b39
      Simon Marlow authored
      Calling varargs functions is explicitly deprecated according to the
      FFI specification.  It used to work, just about, but it broke with the
      recent changes to the via-C backend to not use header files.
      e6a38b39
  11. 02 May, 2008 1 commit
  12. 01 May, 2008 3 commits
    • Don Stewart's avatar
      Inline Data.Bits.rotate@Int, enables rotate to be constant folded · a5b73db4
      Don Stewart authored
      All other Bits instances seem to inline well enough on their own
      to enable constant folding, e.g.
      
          sumU . mapU (`shift` 3) . replicateU 10000000 $ (7 :: Int)
      
      goes to:
      
          Main.$wfold =
            \ (ww_sOb :: Int#) (ww1_sOf :: Int#) ->
              case ww1_sOf of wild_XM {
                __DEFAULT -> Main.$wfold (+# ww_sOb 56) (+# wild_XM 1);
                10000000 -> ww_sOb
              }
      
      With this patch, rotate gets inlined and folded too,
      
          sumU . mapU (`rotate` 3) . replicateU 10000000 $ (7 :: Int)
      
      to:
      
        Main.$wfold =
          \ (ww_sO7 :: Int#) (ww1_sOb :: Int#) ->
            case ww1_sOb of wild_XM {
              __DEFAULT -> Main.$wfold (+# ww_sO7 56) (+# wild_XM 1);
              10000000 -> ww_sO7
      
      Whereas it was left as a call to $wrotate before.
          
      a5b73db4
    • keller@cse.unsw.edu.au's avatar
      Moved def. of emptyP · d609d675
      keller@cse.unsw.edu.au authored
      d609d675
    • keller@cse.unsw.edu.au's avatar
      emptyP def to gHC.PArr · 0295b0cd
      keller@cse.unsw.edu.au authored
      0295b0cd
  13. 30 Apr, 2008 3 commits
    • Don Stewart's avatar
    • simonpj@microsoft.com's avatar
    • Don Stewart's avatar
      Add RULES for realToFrac from Int. · 50058d51
      Don Stewart authored
          {-# RULES
          "realToFrac/Int->Double"    realToFrac   = int2Double
          "realToFrac/Int->Float"     realToFrac   = int2Float
            #-}
      
      Note that this only matters for realToFrac. If you've been using
      fromIntegral to promote Int to Doubles, things should be fine as they are.
      
      The following program, using stream fusion to eliminate arrays:
      
          import Data.Array.Vector
      
          n = 40000000
      
          main = do
                let c = replicateU n (2::Double)
                    a = mapU realToFrac (enumFromToU 0 (n-1) ) :: UArr Double
                print (sumU (zipWithU (*) c a))
      
      Yields this loop body without the RULE:
      
          case $wtoRational sc_sY4 of ww_aM7 { (# ww1_aM9, ww2_aMa #) ->
          case $wfromRat ww1_aM9 ww2_aMa of tpl_X1P { D# ipv_sW3 ->
          Main.$s$wfold
            (+# sc_sY4 1)
            (+# wild_X1i 1)
            (+## sc2_sY6 (*## 2.0 ipv_sW3))
      
      And with the rule:
      
         Main.$s$wfold
            (+# sc_sXT 1)
            (+# wild_X1h 1)
            (+## sc2_sXV (*## 2.0 (int2Double# sc_sXT)))
      
      The running time of the program goes from 120 seconds to 0.198 seconds
      with the native backend, and 0.143 seconds with the C backend.
      
      
      And just so I don't forget, here's the difference in resulting
      assembly (x86_64), between the native code generator, and the
      C backend. 
      
      -fasm
      
          Main_zdszdwfold_info:
            movq %rdi,%rax
            cmpq $40000000,%rax
            jne .LcZK
            jmp *(%rbp)
          .LcZK:
            cmpq $39999999,%rsi
            jg .LcZN
            cvtsi2sdq %rsi,%xmm0
            mulsd .LnZP(%rip),%xmm0
            movsd %xmm5,%xmm7
            addsd %xmm0,%xmm7
            incq %rax
            incq %rsi
            movq %rax,%rdi
            movsd %xmm7,%xmm5
            jmp Main_zdszdwfold_info
      
      With the C backend we get the even better assembly, (-fvia-C -optc-O3)
      
          Main_zdszdwfold_info:
              cmpq    $40000000, %rdi
              je  .L9
          .L5:
              cmpq    $39999999, %rsi
              jg  .L9
              cvtsi2sdq   %rsi, %xmm0
              leaq    1(%rdi), %rdi
              addq    $1, %rsi
              addsd   %xmm0, %xmm0
              addsd   %xmm0, %xmm5
              jmp Main_zdszdwfold_info
          .L9:
              jmp *(%rbp)
      
      So might make a useful test once the native codegen project starts up.
      
      50058d51
  14. 27 Apr, 2008 1 commit
  15. 25 Apr, 2008 1 commit
  16. 24 Apr, 2008 1 commit
  17. 22 Apr, 2008 3 commits
  18. 21 Apr, 2008 1 commit
  19. 18 Apr, 2008 1 commit
  20. 12 Apr, 2008 1 commit
  21. 19 Mar, 2008 1 commit
  22. 27 Mar, 2008 1 commit
  23. 25 Mar, 2008 1 commit
  24. 24 Mar, 2008 2 commits
  25. 23 Mar, 2008 2 commits
  26. 22 Mar, 2008 1 commit