summaryrefslogtreecommitdiffstats
path: root/lib/libcompiler_rt
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-06-15 09:04:10 +0000
committered <ed@FreeBSD.org>2013-06-15 09:04:10 +0000
commit48e709729463158dfd3ccd68d23ec12ef93586c0 (patch)
treec659171aa7defdb6220b20a6d6c619541f3c19c7 /lib/libcompiler_rt
parent1fdf0e5b3c9f3f1c562253bf991879774e6a7e9c (diff)
downloadFreeBSD-src-48e709729463158dfd3ccd68d23ec12ef93586c0.zip
FreeBSD-src-48e709729463158dfd3ccd68d23ec12ef93586c0.tar.gz
Let ARM use the custom tailored atomic intrinsics.
Diffstat (limited to 'lib/libcompiler_rt')
-rw-r--r--lib/libcompiler_rt/Makefile11
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_add_4.c6
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_and_4.c7
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_op_n.h56
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_or_4.c7
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_sub_4.c6
-rw-r--r--lib/libcompiler_rt/__sync_fetch_and_xor_4.c7
-rw-r--r--lib/libcompiler_rt/__sync_lock_test_and_set_4.c7
-rw-r--r--lib/libcompiler_rt/__sync_synchronize.c47
-rw-r--r--lib/libcompiler_rt/__sync_val_compare_and_swap_4.c6
-rw-r--r--lib/libcompiler_rt/__sync_val_compare_and_swap_n.h54
11 files changed, 3 insertions, 211 deletions
diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
index a02877c..cc89c61 100644
--- a/lib/libcompiler_rt/Makefile
+++ b/lib/libcompiler_rt/Makefile
@@ -158,14 +158,9 @@ SRCF+= divsi3 \
# FreeBSD-specific atomic intrinsics.
.if ${MACHINE_CPUARCH} == "arm"
-SRCF+= __sync_fetch_and_add_4 \
- __sync_fetch_and_and_4 \
- __sync_fetch_and_or_4 \
- __sync_fetch_and_sub_4 \
- __sync_fetch_and_xor_4 \
- __sync_lock_test_and_set_4 \
- __sync_synchronize \
- __sync_val_compare_and_swap_4
+.PATH: ${.CURDIR}/../../sys/arm/arm
+
+SRCF+= stdatomic
.elif ${MACHINE_CPUARCH} == "mips"
.PATH: ${.CURDIR}/../../sys/mips/mips
diff --git a/lib/libcompiler_rt/__sync_fetch_and_add_4.c b/lib/libcompiler_rt/__sync_fetch_and_add_4.c
deleted file mode 100644
index 6126cfa..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_add_4.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_fetch_and_add_4
-#define TYPE int32_t
-#define FETCHADD(x, y) atomic_fetchadd_32(x, y)
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_fetch_and_and_4.c b/lib/libcompiler_rt/__sync_fetch_and_and_4.c
deleted file mode 100644
index 49fab80..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_and_4.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_fetch_and_and_4
-#define TYPE int32_t
-#define CMPSET atomic_cmpset_32
-#define EXPRESSION t & value
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_fetch_and_op_n.h b/lib/libcompiler_rt/__sync_fetch_and_op_n.h
deleted file mode 100644
index 524c1cf..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_op_n.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-
-#ifdef __clang__
-static TYPE
-atomic_func(volatile TYPE *ptr, TYPE value, ...)
-#else
-TYPE
-NAME(volatile TYPE *ptr, TYPE value)
-#endif
-{
- TYPE t;
-
-#ifdef FETCHADD
- t = FETCHADD(ptr, value);
-#else
- do {
- t = *ptr;
- } while (!CMPSET(ptr, t, EXPRESSION));
-#endif
-
- return (t);
-}
-
-#ifdef __clang__
-__strong_reference(atomic_func, NAME);
-#endif
diff --git a/lib/libcompiler_rt/__sync_fetch_and_or_4.c b/lib/libcompiler_rt/__sync_fetch_and_or_4.c
deleted file mode 100644
index 879b9ae..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_or_4.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_fetch_and_or_4
-#define TYPE int32_t
-#define CMPSET atomic_cmpset_32
-#define EXPRESSION t | value
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_fetch_and_sub_4.c b/lib/libcompiler_rt/__sync_fetch_and_sub_4.c
deleted file mode 100644
index e0fe14c..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_sub_4.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_fetch_and_sub_4
-#define TYPE int32_t
-#define FETCHADD(x, y) atomic_fetchadd_32(x, -(y))
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_fetch_and_xor_4.c b/lib/libcompiler_rt/__sync_fetch_and_xor_4.c
deleted file mode 100644
index 8a6aec6..0000000
--- a/lib/libcompiler_rt/__sync_fetch_and_xor_4.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_fetch_and_xor_4
-#define TYPE int32_t
-#define CMPSET atomic_cmpset_32
-#define EXPRESSION t ^ value
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_lock_test_and_set_4.c b/lib/libcompiler_rt/__sync_lock_test_and_set_4.c
deleted file mode 100644
index 73d1bab..0000000
--- a/lib/libcompiler_rt/__sync_lock_test_and_set_4.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_lock_test_and_set_4
-#define TYPE int32_t
-#define CMPSET atomic_cmpset_32
-#define EXPRESSION value
-
-#include "__sync_fetch_and_op_n.h"
diff --git a/lib/libcompiler_rt/__sync_synchronize.c b/lib/libcompiler_rt/__sync_synchronize.c
deleted file mode 100644
index 51e08db..0000000
--- a/lib/libcompiler_rt/__sync_synchronize.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-
-#ifdef __clang__
-static void
-atomic_func(void)
-#else
-void
-__sync_synchronize(void)
-#endif
-{
-
- mb();
-}
-
-#ifdef __clang__
-__strong_reference(atomic_func, __sync_synchronize);
-#endif
diff --git a/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c b/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c
deleted file mode 100644
index d69b6f5..0000000
--- a/lib/libcompiler_rt/__sync_val_compare_and_swap_4.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $FreeBSD$ */
-#define NAME __sync_val_compare_and_swap_4
-#define TYPE int32_t
-#define CMPSET atomic_cmpset_32
-
-#include "__sync_val_compare_and_swap_n.h"
diff --git a/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h b/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h
deleted file mode 100644
index b6017c9..0000000
--- a/lib/libcompiler_rt/__sync_val_compare_and_swap_n.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-
-#ifdef __clang__
-static TYPE
-atomic_func(volatile TYPE *ptr, TYPE oldval, TYPE newval, ...)
-#else
-TYPE
-NAME(volatile TYPE *ptr, TYPE oldval, TYPE newval)
-#endif
-{
- TYPE t;
-
- while (!CMPSET(ptr, oldval, newval)) {
- t = *ptr;
- if (t != oldval)
- return (t);
- }
-
- return (oldval);
-}
-
-#ifdef __clang__
-__strong_reference(atomic_func, NAME);
-#endif
OpenPOWER on IntegriCloud