From owner-svn-src-head@freebsd.org Tue Sep 22 19:57:32 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A004A06F1D; Tue, 22 Sep 2015 19:57:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 618A810E7; Tue, 22 Sep 2015 19:57:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8MJvWDw011911; Tue, 22 Sep 2015 19:57:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8MJvWwY011910; Tue, 22 Sep 2015 19:57:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201509221957.t8MJvWwY011910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Sep 2015 19:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288125 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2015 19:57:32 -0000 Author: andrew Date: Tue Sep 22 19:57:31 2015 New Revision: 288125 URL: https://svnweb.freebsd.org/changeset/base/288125 Log: Add support for __atomic_FOO_fetch on arm prior to armv6. These return the new value where the existing functions return the old value. MFC after: 1 Week Modified: head/sys/arm/arm/stdatomic.c Modified: head/sys/arm/arm/stdatomic.c ============================================================================== --- head/sys/arm/arm/stdatomic.c Tue Sep 22 19:05:44 2015 (r288124) +++ head/sys/arm/arm/stdatomic.c Tue Sep 22 19:57:31 2015 (r288125) @@ -270,11 +270,11 @@ __atomic_compare_exchange_##N(uintN_t *m } \ } -#define EMIT_FETCH_OP_N(N, uintN_t, ldr, str, name, op) \ +#define EMIT_FETCH_OP_N(N, uintN_t, ldr, str, name, op, ret) \ uintN_t \ __atomic_##name##_##N(uintN_t *mem, uintN_t val, int model __unused) \ { \ - uint32_t old, temp, ras_start; \ + uint32_t old, new, ras_start; \ \ ras_start = ARM_RAS_START; \ __asm volatile ( \ @@ -295,9 +295,9 @@ __atomic_##name##_##N(uintN_t *mem, uint "\tstr %2, [%5]\n" \ "\tmov %2, #0xffffffff\n" \ "\tstr %2, [%5, #4]\n" \ - : "=&r" (old), "=m" (*mem), "=&r" (temp) \ + : "=&r" (old), "=m" (*mem), "=&r" (new) \ : "r" (val), "m" (*mem), "r" (ras_start)); \ - return (old); \ + return (ret); \ } #define EMIT_ALL_OPS_N(N, uintN_t, ldr, str, streq) \ @@ -305,11 +305,16 @@ EMIT_LOAD_N(N, uintN_t) \ EMIT_STORE_N(N, uintN_t) \ EMIT_EXCHANGE_N(N, uintN_t, ldr, str) \ EMIT_COMPARE_EXCHANGE_N(N, uintN_t, ldr, streq) \ -EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_add, "add") \ -EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_and, "and") \ -EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_or, "orr") \ -EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_sub, "sub") \ -EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_xor, "eor") +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_add, "add", old) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_and, "and", old) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_or, "orr", old) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_sub, "sub", old) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, fetch_xor, "eor", old) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, add_fetch, "add", new) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, and_fetch, "and", new) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, or_fetch, "orr", new) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, sub_fetch, "sub", new) \ +EMIT_FETCH_OP_N(N, uintN_t, ldr, str, xor_fetch, "eor", new) EMIT_ALL_OPS_N(1, uint8_t, "ldrb", "strb", "strbeq") EMIT_ALL_OPS_N(2, uint16_t, "ldrh", "strh", "strheq")