[GHC] #2269: Word type to Double or Float conversions are slower than Int conversions

GHC ghc-devs at haskell.org
Thu Feb 2 17:19:10 UTC 2017


#2269: Word type to Double or Float conversions are slower than Int conversions
-------------------------------------+-------------------------------------
        Reporter:  dons              |                Owner:  dons@…
            Type:  feature request   |               Status:  new
        Priority:  lowest            |            Milestone:
       Component:  Compiler          |              Version:  6.8.2
      Resolution:                    |             Keywords:  rules,
                                     |  performance, double, newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by rwbarton):

 * keywords:  rules, performance, double => rules, performance, double,
     newcomer


Comment:

 Namely,
 {{{
 double f(unsigned long x)
 {
   return x;
 }

 /*
 0000000000000000 <f>:
    0:   66 48 0f 6e cf          movq   %rdi,%xmm1
    5:   66 0f 62 0d 00 00 00    punpckldq 0x0(%rip),%xmm1        # d
 <f+0xd>
    c:   00
             9: R_X86_64_PC32    .LCPI0_0-0x4
    d:   66 0f 5c 0d 00 00 00    subpd  0x0(%rip),%xmm1        # 15
 <f+0x15>
   14:   00
             11: R_X86_64_PC32   .LCPI0_1-0x4
   15:   66 0f 70 c1 4e          pshufd $0x4e,%xmm1,%xmm0
   1a:   66 0f 58 c1             addpd  %xmm1,%xmm0
   1e:   c3                      retq
 */
 }}}

 Compiling the test program here with LLVM there's no measurable difference
 between the int and word versions, so I guess doing this is worthwhile.

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


More information about the ghc-tickets mailing list