[GHC] #9346: AtomicPrimOps tests failing on 32-bit x86

GHC ghc-devs at haskell.org
Tue Jul 22 11:39:49 UTC 2014


#9346: AtomicPrimOps tests failing on 32-bit x86
-------------------------------------+-------------------------------------
              Reporter:  niklasl     |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.9
            Resolution:              |          Keywords:
Differential Revisions:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |         Test Case:
            Difficulty:  Unknown     |          Blocking:
            Blocked By:              |
       Related Tickets:              |
-------------------------------------+-------------------------------------

Comment (by pgj):

 I may be wrong here, but looks like the native code generator generates
 bad code.  The {{{lock cmpxchg}}} instruction appears to be interleaved
 with the preceding {{{mov}}} instruction, hence {{{lock mov}}} is got.

 For {{{AtomicPrimops}}}, the following snippet is present in the generated
 assembly code:

 {{{
 .Ln3sa:
         movl %ecx,64(%esp)
         movl %eax,%ecx
         movl %edx,76(%esp)
         movl %eax,%edx
         movl %ecx,88(%esp)
         movl 76(%esp),%ecx
         xorl %ecx,%edx
         lock
         movl 64(%esp),%ecx
         cmpxchgl %edx,(%ecx)
         jne .Ln3sd
         movl 88(%esp),%eax
         movl $ghczmprim_GHCziTuple_Z0T_closure+1,%esi
         jmp *(%ebp)
 .Ln3sd:
         movl 76(%esp),%edx
         jmp .Ln3sa
 }}}

 According to the sources, this does not seem to be intended.

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


More information about the ghc-tickets mailing list