[GHC] #10677: slightly silly assembly for testing whether a Word# is 0##
GHC
ghc-devs at haskell.org
Thu Jul 23 19:29:48 UTC 2015
#10677: slightly silly assembly for testing whether a Word# is 0##
-------------------------------------+-------------------------------------
Reporter: rwbarton | Owner:
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.11
(CodeGen) |
Keywords: | Operating System: Unknown/Multiple
Architecture: x86_64 | Type of failure: Runtime
(amd64) | performance bug
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
{{{
{-# LANGUAGE MagicHash #-}
module Zero where
import GHC.Exts
f :: Word# -> Word#
f 0## = 1##
f x## = x##
}}}
in HEAD produces
{{{
0000000000000018 <ZZero_f_info>:
18: 49 83 fe 01 cmp $0x1,%r14
1c: 72 06 jb 24 <ZZero_f_info+0xc>
1e: 4c 89 f3 mov %r14,%rbx
21: ff 65 00 jmpq *0x0(%rbp)
24: bb 01 00 00 00 mov $0x1,%ebx
29: ff 65 00 jmpq *0x0(%rbp)
}}}
Well, `cmp $0x1,%r14/jb` isn't wrong. But it's a byte longer than `test
%r14,%r14/je`, so the latter should be preferred.
GHC 7.10 produced the `test/je` version, so I'm guessing this is a side
effect of nomeata's work on #10137.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10677>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list