linux-atomic.c (SUBWORD_VAL_CAS): Instantiate with 'unsigned short' and 'unsigned char' instead of 'short' and 'char'.

* config/pa/linux-atomic.c (SUBWORD_VAL_CAS): Instantiate with
	'unsigned short' and 'unsigned char' instead of 'short' and 'char'.
	(SUBWORD_BOOL_CAS): Likewise.
	(SUBWORD_SYNC_OP): Likewise.
	(SUBWORD_TEST_AND_SET): Likewise.
	(FETCH_AND_OP_WORD): Parenthesise INF_OP
	(SUBWORD_SYNC_OP): Likewise.
	(OP_AND_FETCH_WORD): Likewise.

From-SVN: r163089
This commit is contained in:
John David Anglin 2010-08-11 02:18:07 +00:00 committed by John David Anglin
parent 1ae0fa1c16
commit e5fbc9bf5f
2 changed files with 47 additions and 36 deletions

View File

@ -1,3 +1,14 @@
2010-08-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* config/pa/linux-atomic.c (SUBWORD_VAL_CAS): Instantiate with
'unsigned short' and 'unsigned char' instead of 'short' and 'char'.
(SUBWORD_BOOL_CAS): Likewise.
(SUBWORD_SYNC_OP): Likewise.
(SUBWORD_TEST_AND_SET): Likewise.
(FETCH_AND_OP_WORD): Parenthesise INF_OP
(SUBWORD_SYNC_OP): Likewise.
(OP_AND_FETCH_WORD): Likewise.
2010-08-10 Xinliang David Li <davidxl@google.com> 2010-08-10 Xinliang David Li <davidxl@google.com>
* tree-ssa-loop-ivopts.c (get_address_cost): Properly * tree-ssa-loop-ivopts.c (get_address_cost): Properly

View File

@ -1,5 +1,5 @@
/* Linux-specific atomic operations for PA Linux. /* Linux-specific atomic operations for PA Linux.
Copyright (C) 2008, 2009 Free Software Foundation, Inc. Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
Based on code contributed by CodeSourcery for ARM EABI Linux. Based on code contributed by CodeSourcery for ARM EABI Linux.
Modifications for PA Linux by Helge Deller <deller@gmx.de> Modifications for PA Linux by Helge Deller <deller@gmx.de>
@ -92,7 +92,7 @@ __kernel_cmpxchg (int oldval, int newval, int *mem)
\ \
do { \ do { \
tmp = *ptr; \ tmp = *ptr; \
failure = __kernel_cmpxchg (tmp, PFX_OP tmp INF_OP val, ptr); \ failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \ } while (failure != 0); \
\ \
return tmp; \ return tmp; \
@ -124,8 +124,8 @@ FETCH_AND_OP_WORD (nand, ~, &)
\ \
do { \ do { \
oldval = *wordptr; \ oldval = *wordptr; \
newval = ((PFX_OP ((oldval & mask) >> shift) \ newval = ((PFX_OP (((oldval & mask) >> shift) \
INF_OP (unsigned int) val) << shift) & mask; \ INF_OP (unsigned int) val)) << shift) & mask; \
newval |= oldval & ~mask; \ newval |= oldval & ~mask; \
failure = __kernel_cmpxchg (oldval, newval, wordptr); \ failure = __kernel_cmpxchg (oldval, newval, wordptr); \
} while (failure != 0); \ } while (failure != 0); \
@ -133,19 +133,19 @@ FETCH_AND_OP_WORD (nand, ~, &)
return (RETURN & mask) >> shift; \ return (RETURN & mask) >> shift; \
} }
SUBWORD_SYNC_OP (add, , +, short, 2, oldval) SUBWORD_SYNC_OP (add, , +, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (sub, , -, short, 2, oldval) SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (or, , |, short, 2, oldval) SUBWORD_SYNC_OP (or, , |, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (and, , &, short, 2, oldval) SUBWORD_SYNC_OP (and, , &, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (xor, , ^, short, 2, oldval) SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (nand, ~, &, short, 2, oldval) SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval)
SUBWORD_SYNC_OP (add, , +, char, 1, oldval) SUBWORD_SYNC_OP (add, , +, unsigned char, 1, oldval)
SUBWORD_SYNC_OP (sub, , -, char, 1, oldval) SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, oldval)
SUBWORD_SYNC_OP (or, , |, char, 1, oldval) SUBWORD_SYNC_OP (or, , |, unsigned char, 1, oldval)
SUBWORD_SYNC_OP (and, , &, char, 1, oldval) SUBWORD_SYNC_OP (and, , &, unsigned char, 1, oldval)
SUBWORD_SYNC_OP (xor, , ^, char, 1, oldval) SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, oldval)
SUBWORD_SYNC_OP (nand, ~, &, char, 1, oldval) SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval)
#define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \ #define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \
int HIDDEN \ int HIDDEN \
@ -155,10 +155,10 @@ SUBWORD_SYNC_OP (nand, ~, &, char, 1, oldval)
\ \
do { \ do { \
tmp = *ptr; \ tmp = *ptr; \
failure = __kernel_cmpxchg (tmp, PFX_OP tmp INF_OP val, ptr); \ failure = __kernel_cmpxchg (tmp, PFX_OP (tmp INF_OP val), ptr); \
} while (failure != 0); \ } while (failure != 0); \
\ \
return PFX_OP tmp INF_OP val; \ return PFX_OP (tmp INF_OP val); \
} }
OP_AND_FETCH_WORD (add, , +) OP_AND_FETCH_WORD (add, , +)
@ -168,19 +168,19 @@ OP_AND_FETCH_WORD (and, , &)
OP_AND_FETCH_WORD (xor, , ^) OP_AND_FETCH_WORD (xor, , ^)
OP_AND_FETCH_WORD (nand, ~, &) OP_AND_FETCH_WORD (nand, ~, &)
SUBWORD_SYNC_OP (add, , +, short, 2, newval) SUBWORD_SYNC_OP (add, , +, unsigned short, 2, newval)
SUBWORD_SYNC_OP (sub, , -, short, 2, newval) SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, newval)
SUBWORD_SYNC_OP (or, , |, short, 2, newval) SUBWORD_SYNC_OP (or, , |, unsigned short, 2, newval)
SUBWORD_SYNC_OP (and, , &, short, 2, newval) SUBWORD_SYNC_OP (and, , &, unsigned short, 2, newval)
SUBWORD_SYNC_OP (xor, , ^, short, 2, newval) SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, newval)
SUBWORD_SYNC_OP (nand, ~, &, short, 2, newval) SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval)
SUBWORD_SYNC_OP (add, , +, char, 1, newval) SUBWORD_SYNC_OP (add, , +, unsigned char, 1, newval)
SUBWORD_SYNC_OP (sub, , -, char, 1, newval) SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, newval)
SUBWORD_SYNC_OP (or, , |, char, 1, newval) SUBWORD_SYNC_OP (or, , |, unsigned char, 1, newval)
SUBWORD_SYNC_OP (and, , &, char, 1, newval) SUBWORD_SYNC_OP (and, , &, unsigned char, 1, newval)
SUBWORD_SYNC_OP (xor, , ^, char, 1, newval) SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, newval)
SUBWORD_SYNC_OP (nand, ~, &, char, 1, newval) SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval)
int HIDDEN int HIDDEN
__sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval) __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
@ -230,8 +230,8 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
} \ } \
} }
SUBWORD_VAL_CAS (short, 2) SUBWORD_VAL_CAS (unsigned short, 2)
SUBWORD_VAL_CAS (char, 1) SUBWORD_VAL_CAS (unsigned char, 1)
typedef unsigned char bool; typedef unsigned char bool;
@ -252,8 +252,8 @@ __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
return (oldval == actual_oldval); \ return (oldval == actual_oldval); \
} }
SUBWORD_BOOL_CAS (short, 2) SUBWORD_BOOL_CAS (unsigned short, 2)
SUBWORD_BOOL_CAS (char, 1) SUBWORD_BOOL_CAS (unsigned char, 1)
int HIDDEN int HIDDEN
__sync_lock_test_and_set_4 (int *ptr, int val) __sync_lock_test_and_set_4 (int *ptr, int val)
@ -289,8 +289,8 @@ __sync_lock_test_and_set_4 (int *ptr, int val)
return (oldval & mask) >> shift; \ return (oldval & mask) >> shift; \
} }
SUBWORD_TEST_AND_SET (short, 2) SUBWORD_TEST_AND_SET (unsigned short, 2)
SUBWORD_TEST_AND_SET (char, 1) SUBWORD_TEST_AND_SET (unsigned char, 1)
#define SYNC_LOCK_RELEASE(TYPE, WIDTH) \ #define SYNC_LOCK_RELEASE(TYPE, WIDTH) \
void HIDDEN \ void HIDDEN \