From patchwork Wed Aug 11 02:28:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 61424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D709DB70AB for ; Wed, 11 Aug 2010 12:28:20 +1000 (EST) Received: (qmail 25010 invoked by alias); 11 Aug 2010 02:28:18 -0000 Received: (qmail 24949 invoked by uid 22791); 11 Aug 2010 02:28:16 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Aug 2010 02:28:11 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 0628F4D2B; Tue, 10 Aug 2010 22:28:09 -0400 (EDT) Date: Tue, 10 Aug 2010 22:28:08 -0400 From: John David Anglin To: gcc-patches@gcc.gnu.org Subject: [committed] Update config/pa/linux-atomic.c and enable sync tests on hppa-linux Message-ID: <20100811022808.GA25554@hiauly1.hia.nrc.ca> Reply-To: John David Anglin MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The attached patches are essentially identical to that recently applied to arm. Tested on hppa-unknown-linux-gnu with no observed regressions. Committed to trunk. Plan to backport to 4.4 and 4.5 after testing. Dave Index: config/pa/linux-atomic.c =================================================================== --- config/pa/linux-atomic.c (revision 162979) +++ config/pa/linux-atomic.c (working copy) @@ -1,5 +1,5 @@ /* 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. Modifications for PA Linux by Helge Deller @@ -92,7 +92,7 @@ \ do { \ 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); \ \ return tmp; \ @@ -124,8 +124,8 @@ \ do { \ oldval = *wordptr; \ - newval = ((PFX_OP ((oldval & mask) >> shift) \ - INF_OP (unsigned int) val) << shift) & mask; \ + newval = ((PFX_OP (((oldval & mask) >> shift) \ + INF_OP (unsigned int) val)) << shift) & mask; \ newval |= oldval & ~mask; \ failure = __kernel_cmpxchg (oldval, newval, wordptr); \ } while (failure != 0); \ @@ -133,19 +133,19 @@ return (RETURN & mask) >> shift; \ } -SUBWORD_SYNC_OP (add, , +, short, 2, oldval) -SUBWORD_SYNC_OP (sub, , -, short, 2, oldval) -SUBWORD_SYNC_OP (or, , |, short, 2, oldval) -SUBWORD_SYNC_OP (and, , &, short, 2, oldval) -SUBWORD_SYNC_OP (xor, , ^, short, 2, oldval) -SUBWORD_SYNC_OP (nand, ~, &, short, 2, oldval) - -SUBWORD_SYNC_OP (add, , +, char, 1, oldval) -SUBWORD_SYNC_OP (sub, , -, char, 1, oldval) -SUBWORD_SYNC_OP (or, , |, char, 1, oldval) -SUBWORD_SYNC_OP (and, , &, char, 1, oldval) -SUBWORD_SYNC_OP (xor, , ^, char, 1, oldval) -SUBWORD_SYNC_OP (nand, ~, &, char, 1, oldval) +SUBWORD_SYNC_OP (add, , +, unsigned short, 2, oldval) +SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, oldval) +SUBWORD_SYNC_OP (or, , |, unsigned short, 2, oldval) +SUBWORD_SYNC_OP (and, , &, unsigned short, 2, oldval) +SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, oldval) +SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, oldval) + +SUBWORD_SYNC_OP (add, , +, unsigned char, 1, oldval) +SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, oldval) +SUBWORD_SYNC_OP (or, , |, unsigned char, 1, oldval) +SUBWORD_SYNC_OP (and, , &, unsigned char, 1, oldval) +SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, oldval) +SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, oldval) #define OP_AND_FETCH_WORD(OP, PFX_OP, INF_OP) \ int HIDDEN \ @@ -155,10 +155,10 @@ \ do { \ 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); \ \ - return PFX_OP tmp INF_OP val; \ + return PFX_OP (tmp INF_OP val); \ } OP_AND_FETCH_WORD (add, , +) @@ -168,19 +168,19 @@ OP_AND_FETCH_WORD (xor, , ^) OP_AND_FETCH_WORD (nand, ~, &) -SUBWORD_SYNC_OP (add, , +, short, 2, newval) -SUBWORD_SYNC_OP (sub, , -, short, 2, newval) -SUBWORD_SYNC_OP (or, , |, short, 2, newval) -SUBWORD_SYNC_OP (and, , &, short, 2, newval) -SUBWORD_SYNC_OP (xor, , ^, short, 2, newval) -SUBWORD_SYNC_OP (nand, ~, &, short, 2, newval) - -SUBWORD_SYNC_OP (add, , +, char, 1, newval) -SUBWORD_SYNC_OP (sub, , -, char, 1, newval) -SUBWORD_SYNC_OP (or, , |, char, 1, newval) -SUBWORD_SYNC_OP (and, , &, char, 1, newval) -SUBWORD_SYNC_OP (xor, , ^, char, 1, newval) -SUBWORD_SYNC_OP (nand, ~, &, char, 1, newval) +SUBWORD_SYNC_OP (add, , +, unsigned short, 2, newval) +SUBWORD_SYNC_OP (sub, , -, unsigned short, 2, newval) +SUBWORD_SYNC_OP (or, , |, unsigned short, 2, newval) +SUBWORD_SYNC_OP (and, , &, unsigned short, 2, newval) +SUBWORD_SYNC_OP (xor, , ^, unsigned short, 2, newval) +SUBWORD_SYNC_OP (nand, ~, &, unsigned short, 2, newval) + +SUBWORD_SYNC_OP (add, , +, unsigned char, 1, newval) +SUBWORD_SYNC_OP (sub, , -, unsigned char, 1, newval) +SUBWORD_SYNC_OP (or, , |, unsigned char, 1, newval) +SUBWORD_SYNC_OP (and, , &, unsigned char, 1, newval) +SUBWORD_SYNC_OP (xor, , ^, unsigned char, 1, newval) +SUBWORD_SYNC_OP (nand, ~, &, unsigned char, 1, newval) int HIDDEN __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval) @@ -230,8 +230,8 @@ } \ } -SUBWORD_VAL_CAS (short, 2) -SUBWORD_VAL_CAS (char, 1) +SUBWORD_VAL_CAS (unsigned short, 2) +SUBWORD_VAL_CAS (unsigned char, 1) typedef unsigned char bool; @@ -252,8 +252,8 @@ return (oldval == actual_oldval); \ } -SUBWORD_BOOL_CAS (short, 2) -SUBWORD_BOOL_CAS (char, 1) +SUBWORD_BOOL_CAS (unsigned short, 2) +SUBWORD_BOOL_CAS (unsigned char, 1) int HIDDEN __sync_lock_test_and_set_4 (int *ptr, int val) @@ -289,8 +289,8 @@ return (oldval & mask) >> shift; \ } -SUBWORD_TEST_AND_SET (short, 2) -SUBWORD_TEST_AND_SET (char, 1) +SUBWORD_TEST_AND_SET (unsigned short, 2) +SUBWORD_TEST_AND_SET (unsigned char, 1) #define SYNC_LOCK_RELEASE(TYPE, WIDTH) \ void HIDDEN \