Use "+m" constraint instead of separate "m" constraints.

This commit is contained in:
Andreas Schwab 2004-05-23 10:22:47 +00:00
parent 3abc82c8ce
commit eac72c200d

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2003 Free Software Foundation, Inc. /* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@suse.de>, 2003. Contributed by Andreas Schwab <schwab@suse.de>, 2003.
@ -48,22 +48,22 @@ typedef uintmax_t uatomic_max_t;
#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
({ __typeof (*(mem)) __ret; \ ({ __typeof (*(mem)) __ret; \
__asm __volatile ("cas%.b %0,%2,%1" \ __asm __volatile ("cas%.b %0,%2,%1" \
: "=d" (__ret), "=m" (*(mem)) \ : "=d" (__ret), "+m" (*(mem)) \
: "d" (newval), "m" (*(mem)), "0" (oldval)); \ : "d" (newval), "0" (oldval)); \
__ret; }) __ret; })
#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
({ __typeof (*(mem)) __ret; \ ({ __typeof (*(mem)) __ret; \
__asm __volatile ("cas%.w %0,%2,%1" \ __asm __volatile ("cas%.w %0,%2,%1" \
: "=d" (__ret), "=m" (*(mem)) \ : "=d" (__ret), "+m" (*(mem)) \
: "d" (newval), "m" (*(mem)), "0" (oldval)); \ : "d" (newval), "0" (oldval)); \
__ret; }) __ret; })
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ __typeof (*(mem)) __ret; \ ({ __typeof (*(mem)) __ret; \
__asm __volatile ("cas%.l %0,%2,%1" \ __asm __volatile ("cas%.l %0,%2,%1" \
: "=d" (__ret), "=m" (*(mem)) \ : "=d" (__ret), "+m" (*(mem)) \
: "d" (newval), "m" (*(mem)), "0" (oldval)); \ : "d" (newval), "0" (oldval)); \
__ret; }) __ret; })
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
@ -81,18 +81,18 @@ typedef uintmax_t uatomic_max_t;
if (sizeof (*(mem)) == 1) \ if (sizeof (*(mem)) == 1) \
__asm __volatile ("1: cas%.b %0,%2,%1;" \ __asm __volatile ("1: cas%.b %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)) \ : "=d" (__result), "+m" (*(mem)) \
: "d" (newvalue), "m" (*(mem)), "0" (__result)); \ : "d" (newvalue), "0" (__result)); \
else if (sizeof (*(mem)) == 2) \ else if (sizeof (*(mem)) == 2) \
__asm __volatile ("1: cas%.w %0,%2,%1;" \ __asm __volatile ("1: cas%.w %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)) \ : "=d" (__result), "+m" (*(mem)) \
: "d" (newvalue), "m" (*(mem)), "0" (__result)); \ : "d" (newvalue), "0" (__result)); \
else if (sizeof (*(mem)) == 4) \ else if (sizeof (*(mem)) == 4) \
__asm __volatile ("1: cas%.l %0,%2,%1;" \ __asm __volatile ("1: cas%.l %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)) \ : "=d" (__result), "+m" (*(mem)) \
: "d" (newvalue), "m" (*(mem)), "0" (__result)); \ : "d" (newvalue), "0" (__result)); \
else \ else \
{ \ { \
__typeof (mem) __memp = (mem); \ __typeof (mem) __memp = (mem); \
@ -113,25 +113,25 @@ typedef uintmax_t uatomic_max_t;
" add%.b %3,%2;" \ " add%.b %3,%2;" \
" cas%.b %0,%2,%1;" \ " cas%.b %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)), \ : "=d" (__result), "+m" (*(mem)), \
"=&d" (__temp) \ "=&d" (__temp) \
: "d" (value), "m" (*(mem)), "0" (__result)); \ : "d" (value), "0" (__result)); \
else if (sizeof (*(mem)) == 2) \ else if (sizeof (*(mem)) == 2) \
__asm __volatile ("1: move%.w %0,%2;" \ __asm __volatile ("1: move%.w %0,%2;" \
" add%.w %3,%2;" \ " add%.w %3,%2;" \
" cas%.w %0,%2,%1;" \ " cas%.w %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)), \ : "=d" (__result), "+m" (*(mem)), \
"=&d" (__temp) \ "=&d" (__temp) \
: "d" (value), "m" (*(mem)), "0" (__result)); \ : "d" (value), "0" (__result)); \
else if (sizeof (*(mem)) == 4) \ else if (sizeof (*(mem)) == 4) \
__asm __volatile ("1: move%.l %0,%2;" \ __asm __volatile ("1: move%.l %0,%2;" \
" add%.l %3,%2;" \ " add%.l %3,%2;" \
" cas%.l %0,%2,%1;" \ " cas%.l %0,%2,%1;" \
" jbne 1b" \ " jbne 1b" \
: "=d" (__result), "=m" (*(mem)), \ : "=d" (__result), "+m" (*(mem)), \
"=&d" (__temp) \ "=&d" (__temp) \
: "d" (value), "m" (*(mem)), "0" (__result)); \ : "d" (value), "0" (__result)); \
else \ else \
{ \ { \
__typeof (mem) __memp = (mem); \ __typeof (mem) __memp = (mem); \
@ -151,16 +151,16 @@ typedef uintmax_t uatomic_max_t;
#define atomic_add(mem, value) \ #define atomic_add(mem, value) \
(void) ({ if (sizeof (*(mem)) == 1) \ (void) ({ if (sizeof (*(mem)) == 1) \
__asm __volatile ("add%.b %1,%0" \ __asm __volatile ("add%.b %1,%0" \
: "=m" (*(mem)) \ : "+m" (*(mem)) \
: "id" (value), "m" (*(mem))); \ : "id" (value)); \
else if (sizeof (*(mem)) == 2) \ else if (sizeof (*(mem)) == 2) \
__asm __volatile ("add%.w %1,%0" \ __asm __volatile ("add%.w %1,%0" \
: "=m" (*(mem)) \ : "+m" (*(mem)) \
: "id" (value), "m" (*(mem))); \ : "id" (value)); \
else if (sizeof (*(mem)) == 4) \ else if (sizeof (*(mem)) == 4) \
__asm __volatile ("add%.l %1,%0" \ __asm __volatile ("add%.l %1,%0" \
: "=m" (*(mem)) \ : "+m" (*(mem)) \
: "id" (value), "m" (*(mem))); \ : "id" (value)); \
else \ else \
{ \ { \
__typeof (mem) __memp = (mem); \ __typeof (mem) __memp = (mem); \
@ -183,16 +183,13 @@ typedef uintmax_t uatomic_max_t;
({ char __result; \ ({ char __result; \
if (sizeof (*(mem)) == 1) \ if (sizeof (*(mem)) == 1) \
__asm __volatile ("addq%.b %#1,%1; seq %0" \ __asm __volatile ("addq%.b %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else if (sizeof (*(mem)) == 2) \ else if (sizeof (*(mem)) == 2) \
__asm __volatile ("addq%.w %#1,%1; seq %0" \ __asm __volatile ("addq%.w %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else if (sizeof (*(mem)) == 4) \ else if (sizeof (*(mem)) == 4) \
__asm __volatile ("addq%.l %#1,%1; seq %0" \ __asm __volatile ("addq%.l %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else \ else \
{ \ { \
__typeof (mem) __memp = (mem); \ __typeof (mem) __memp = (mem); \
@ -217,16 +214,13 @@ typedef uintmax_t uatomic_max_t;
({ char __result; \ ({ char __result; \
if (sizeof (*(mem)) == 1) \ if (sizeof (*(mem)) == 1) \
__asm __volatile ("subq%.b %#1,%1; seq %0" \ __asm __volatile ("subq%.b %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else if (sizeof (*(mem)) == 2) \ else if (sizeof (*(mem)) == 2) \
__asm __volatile ("subq%.w %#1,%1; seq %0" \ __asm __volatile ("subq%.w %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else if (sizeof (*(mem)) == 4) \ else if (sizeof (*(mem)) == 4) \
__asm __volatile ("subq%.l %#1,%1; seq %0" \ __asm __volatile ("subq%.l %#1,%1; seq %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem))); \
: "m" (*(mem))); \
else \ else \
{ \ { \
__typeof (mem) __memp = (mem); \ __typeof (mem) __memp = (mem); \
@ -249,13 +243,12 @@ typedef uintmax_t uatomic_max_t;
#define atomic_bit_set(mem, bit) \ #define atomic_bit_set(mem, bit) \
__asm __volatile ("bfset %0{%1,#1}" \ __asm __volatile ("bfset %0{%1,#1}" \
: "=m" (*(mem)) \ : "+m" (*(mem)) \
: "di" (sizeof (*(mem)) * 8 - (bit) - 1), "m" (*(mem))) : "di" (sizeof (*(mem)) * 8 - (bit) - 1))
#define atomic_bit_test_set(mem, bit) \ #define atomic_bit_test_set(mem, bit) \
({ char __result; \ ({ char __result; \
__asm __volatile ("bfset %1{%2,#1}; sne %0" \ __asm __volatile ("bfset %1{%2,#1}; sne %0" \
: "=dm" (__result), "=m" (*(mem)) \ : "=dm" (__result), "+m" (*(mem)) \
: "di" (sizeof (*(mem)) * 8 - (bit) - 1), \ : "di" (sizeof (*(mem)) * 8 - (bit) - 1)); \
"m" (*(mem))); \
__result; }) __result; })