about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@rr.iij4u.or.jp>2012-06-23 07:29:05 +0900
committerKaz Kojima <kkojima@rr.iij4u.or.jp>2012-06-23 07:29:05 +0900
commitd230f50a0639b9bda8562fda3c905a964e371a38 (patch)
tree7feb04479734cb63aa57f485e06eb210e5c04db0 /sysdeps/unix/sysv
parent0479b305c5b7c8e3fa8e3002982cf8cac02b842e (diff)
downloadglibc-d230f50a0639b9bda8562fda3c905a964e371a38.tar.gz
glibc-d230f50a0639b9bda8562fda3c905a964e371a38.tar.xz
glibc-d230f50a0639b9bda8562fda3c905a964e371a38.zip
Fix gUSA sequence in SH atomic functions in
sysdeps/unix/sysv/linux/sh/bits/atomic.h.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/atomic.h187
1 files changed, 94 insertions, 93 deletions
diff --git a/sysdeps/unix/sysv/linux/sh/bits/atomic.h b/sysdeps/unix/sysv/linux/sh/bits/atomic.h
index c8f07e55a4..05e492202b 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/atomic.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations used inside libc.  Linux/SH version.
-   Copyright (C) 2003, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -73,11 +73,10 @@ typedef uintmax_t uatomic_max_t;
 #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
   ({ __typeof (*(mem)) __result; \
      __asm __volatile ("\
-	.align 2\n\
 	mova 1f,r0\n\
-	nop\n\
+	.align 2\n\
 	mov r15,r1\n\
-	mov #-8,r15\n\
+	mov #(0f-1f),r15\n\
      0: mov.b @%1,%0\n\
 	cmp/eq %0,%3\n\
 	bf 1f\n\
@@ -90,10 +89,10 @@ typedef uintmax_t uatomic_max_t;
 #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
   ({ __typeof (*(mem)) __result; \
      __asm __volatile ("\
-	.align 2\n\
 	mova 1f,r0\n\
-	nop\n\
 	mov r15,r1\n\
+	.align 2\n\
+	mov #(0f-1f),r15\n\
 	mov #-8,r15\n\
      0: mov.w @%1,%0\n\
 	cmp/eq %0,%3\n\
@@ -107,11 +106,10 @@ typedef uintmax_t uatomic_max_t;
 #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
   ({ __typeof (*(mem)) __result; \
      __asm __volatile ("\
-	.align 2\n\
 	mova 1f,r0\n\
-	nop\n\
+	.align 2\n\
 	mov r15,r1\n\
-	mov #-8,r15\n\
+	mov #(0f-1f),r15\n\
      0: mov.l @%1,%0\n\
 	cmp/eq %0,%3\n\
 	bf 1f\n\
@@ -133,40 +131,43 @@ typedef uintmax_t uatomic_max_t;
   ({ __typeof (*(mem)) __result, __tmp, __value = (value); \
      if (sizeof (*(mem)) == 1) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.b @%2,%0\n\
-	  add %0,%1\n\
-	  mov.b %1,@%2\n\
+	  mov %1,r2\n\
+	  add %0,r2\n\
+	  mov.b r2,@%2\n\
        1: mov r1,r15"\
 	: "=&r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
-	: "r0", "r1", "memory"); \
+	: "r0", "r1", "r2", "memory");		       \
      else if (sizeof (*(mem)) == 2) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.w @%2,%0\n\
-	  add %0,%1\n\
-	  mov.w %1,@%2\n\
+	  mov %1,r2\n\
+	  add %0,r2\n\
+	  mov.w r2,@%2\n\
        1: mov r1,r15"\
 	: "=&r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
-	: "r0", "r1", "memory"); \
+	: "r0", "r1", "r2", "memory"); \
      else if (sizeof (*(mem)) == 4) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.l @%2,%0\n\
-	  add %0,%1\n\
-	  mov.l %1,@%2\n\
+	  mov %1,r2\n\
+	  add %0,r2\n\
+	  mov.l r2,@%2\n\
        1: mov r1,r15"\
 	: "=&r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
-	: "r0", "r1", "memory"); \
+	: "r0", "r1", "r2", "memory"); \
      else \
        { \
 	 __typeof (mem) memp = (mem); \
@@ -182,37 +183,37 @@ typedef uintmax_t uatomic_max_t;
   (void) ({ __typeof (*(mem)) __tmp, __value = (value); \
 	    if (sizeof (*(mem)) == 1) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.b @%1,r2\n\
-		add r2,%0\n\
-		mov.b %0,@%1\n\
+		add %0,r2\n\
+		mov.b r2,@%1\n\
 	     1: mov r1,r15"\
 		: "=&r" (__tmp) : rNOSP (mem), "0" (__value) \
 		: "r0", "r1", "r2", "memory"); \
 	    else if (sizeof (*(mem)) == 2) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.w @%1,r2\n\
-		add r2,%0\n\
-		mov.w %0,@%1\n\
+		add %0,r2\n\
+		mov.w r2,@%1\n\
 	     1: mov r1,r15"\
 		: "=&r" (__tmp) : rNOSP (mem), "0" (__value) \
 		: "r0", "r1", "r2", "memory"); \
 	    else if (sizeof (*(mem)) == 4) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.l @%1,r2\n\
-		add r2,%0\n\
-		mov.l %0,@%1\n\
+		add %0,r2\n\
+		mov.l r2,@%1\n\
 	     1: mov r1,r15"\
 		: "=&r" (__tmp) : rNOSP (mem), "0" (__value) \
 		: "r0", "r1", "r2", "memory"); \
@@ -233,43 +234,43 @@ typedef uintmax_t uatomic_max_t;
      __typeof (*(mem)) __tmp, __value = (value); \
      if (sizeof (*(mem)) == 1) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.b @%2,r2\n\
-	  add r2,%1\n\
-	  mov.b %1,@%2\n\
+	  add %1,r2\n\
+	  mov.b r2,@%2\n\
        1: mov r1,r15\n\
-	  shal %1\n\
+	  shal r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
      else if (sizeof (*(mem)) == 2) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.w @%2,r2\n\
-	  add r2,%1\n\
-	  mov.w %1,@%2\n\
+	  add %1,r2\n\
+	  mov.w r2,@%2\n\
        1: mov r1,r15\n\
-	  shal %1\n\
+	  shal r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
      else if (sizeof (*(mem)) == 4) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.l @%2,r2\n\
-	  add r2,%1\n\
-	  mov.l %1,@%2\n\
+	  add %1,r2\n\
+	  mov.l r2,@%2\n\
        1: mov r1,r15\n\
-	  shal %1\n\
+	  shal r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
@@ -282,43 +283,43 @@ typedef uintmax_t uatomic_max_t;
      __typeof (*(mem)) __tmp, __value = (value); \
      if (sizeof (*(mem)) == 1) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.b @%2,r2\n\
-	  add r2,%1\n\
-	  mov.b %1,@%2\n\
+	  add %1,r2\n\
+	  mov.b r2,@%2\n\
        1: mov r1,r15\n\
-	  tst %1,%1\n\
+	  tst r2,r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
      else if (sizeof (*(mem)) == 2) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.w @%2,r2\n\
-	  add r2,%1\n\
-	  mov.w %1,@%2\n\
+	  add %1,r2\n\
+	  mov.w r2,@%2\n\
        1: mov r1,r15\n\
-	  tst %1,%1\n\
+	  tst r2,r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
      else if (sizeof (*(mem)) == 4) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
 	  mov r15,r1\n\
-	  mov #-6,r15\n\
+	  .align 2\n\
+	  mov #(0f-1f),r15\n\
        0: mov.l @%2,r2\n\
-	  add r2,%1\n\
-	  mov.l %1,@%2\n\
+	  add %1,r2\n\
+	  mov.l r2,@%2\n\
        1: mov r1,r15\n\
-	  tst %1,%1\n\
+	  tst r2,r2\n\
 	  movt %0"\
 	: "=r" (__result), "=&r" (__tmp) : rNOSP (mem), "1" (__value) \
 	: "r0", "r1", "r2", "t", "memory"); \
@@ -333,10 +334,10 @@ typedef uintmax_t uatomic_max_t;
   (void) ({ unsigned int __mask = 1 << (bit); \
 	    if (sizeof (*(mem)) == 1) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.b @%0,r2\n\
 		or %1,r2\n\
 		mov.b r2,@%0\n\
@@ -345,10 +346,10 @@ typedef uintmax_t uatomic_max_t;
 		: "r0", "r1", "r2", "memory"); \
 	    else if (sizeof (*(mem)) == 2) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.w @%0,r2\n\
 		or %1,r2\n\
 		mov.w r2,@%0\n\
@@ -357,10 +358,10 @@ typedef uintmax_t uatomic_max_t;
 		: "r0", "r1", "r2", "memory"); \
 	    else if (sizeof (*(mem)) == 4) \
 	      __asm __volatile ("\
-		.align 2\n\
 		mova 1f,r0\n\
 		mov r15,r1\n\
-		mov #-6,r15\n\
+		.align 2\n\
+		mov #(0f-1f),r15\n\
 	     0: mov.l @%0,r2\n\
 		or %1,r2\n\
 		mov.l r2,@%0\n\
@@ -376,49 +377,49 @@ typedef uintmax_t uatomic_max_t;
      unsigned int __result = __mask; \
      if (sizeof (*(mem)) == 1) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
-	  nop\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-8,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.b @%2,r2\n\
-	  or r2,%1\n\
-	  and r2,%0\n\
-	  mov.b %1,@%2\n\
-       1: mov r1,r15"\
+	  mov r2,r3\n\
+	  or %1,r2\n\
+	  mov.b r2,@%2\n\
+       1: mov r1,r15\n\
+	  and r3,%0"\
 	: "=&r" (__result), "=&r" (__mask) \
 	: rNOSP (mem), "0" (__result), "1" (__mask) \
-	: "r0", "r1", "r2", "memory"); \
+	: "r0", "r1", "r2", "r3", "memory");	\
      else if (sizeof (*(mem)) == 2) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
-	  nop\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-8,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.w @%2,r2\n\
-	  or r2,%1\n\
-	  and r2,%0\n\
+	  mov r2,r3\n\
+	  or %1,r2\n\
 	  mov.w %1,@%2\n\
-       1: mov r1,r15"\
+       1: mov r1,r15\n\
+	  and r3,%0"\
 	: "=&r" (__result), "=&r" (__mask) \
 	: rNOSP (mem), "0" (__result), "1" (__mask) \
-	: "r0", "r1", "r2", "memory"); \
+	: "r0", "r1", "r2", "r3", "memory"); \
      else if (sizeof (*(mem)) == 4) \
        __asm __volatile ("\
-	  .align 2\n\
 	  mova 1f,r0\n\
-	  nop\n\
+	  .align 2\n\
 	  mov r15,r1\n\
-	  mov #-8,r15\n\
+	  mov #(0f-1f),r15\n\
        0: mov.l @%2,r2\n\
+	  mov r2,r3\n\
 	  or r2,%1\n\
-	  and r2,%0\n\
 	  mov.l %1,@%2\n\
-       1: mov r1,r15"\
+       1: mov r1,r15\n\
+	  and r3,%0"\
 	: "=&r" (__result), "=&r" (__mask) \
 	: rNOSP (mem), "0" (__result), "1" (__mask) \
-	: "r0", "r1", "r2", "memory"); \
+	: "r0", "r1", "r2", "r3", "memory"); \
      else \
        abort (); \
      __result; })