[commit: ghc] ghc-7.10: rts: Fix aarch64 implementation of xchg (1cce187)

git at git.haskell.org git at git.haskell.org
Mon Jun 1 15:01:47 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/1cce18721b1497894fd2b14fc4557f0beafa6f50/ghc

>---------------------------------------------------------------

commit 1cce18721b1497894fd2b14fc4557f0beafa6f50
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Thu May 28 02:57:28 2015 +0000

    rts: Fix aarch64 implementation of xchg
    
    In the previous implementation, the `stlxr` instruction clobbered
    the value that was supposed to be returned by the the `xchg`
    function.
    
    Signed-off-by: Erik de Castro Lopo <erikd at mega-nerd.com>
    
    Test Plan: build on aarch64
    
    Reviewers: austin, bgamari, rwbarton
    
    Subscribers: bgamari, thomie
    
    Differential Revision: https://phabricator.haskell.org/D932
    
    (cherry picked from commit f6ca6959e54ede0b28735ab7e011c16b3cb172db)


>---------------------------------------------------------------

1cce18721b1497894fd2b14fc4557f0beafa6f50
 includes/stg/SMP.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index 5460a2b..156ee42 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -158,13 +158,11 @@ xchg(StgPtr p, StgWord w)
                           : "memory"
                           );
 #elif aarch64_HOST_ARCH
-    // Don't think we actually use tmp here, but leaving
-    // it for consistent numbering
     StgWord tmp; 
     __asm__ __volatile__ (
                           "1:    ldaxr  %0, [%3]\n"
-                          "      stlxr  %w0, %2, [%3]\n"
-                          "      cbnz   %w0, 1b\n"
+                          "      stlxr  %w1, %2, [%3]\n"
+                          "      cbnz   %w1, 1b\n"
                           "      dmb sy\n"
                           : "=&r" (result), "=&r" (tmp)
                           : "r" (w), "r" (p)



More information about the ghc-commits mailing list