From ba6be749f94e6033b8b5bcc23939b7b2f68b7c3f Mon Sep 17 00:00:00 2001 From: Walter Lee Date: Tue, 28 Jun 2016 16:20:58 +0000 Subject: [PATCH] linux.h: Do not include arch/icache.h gcc/ChangeLog * config/tilegx/linux.h: Do not include arch/icache.h (CLEAR_INSN_CACHE): Provide inlined definition directly. * config/tilepro/linux.h: Do not include arch/icache.h (CLEAR_INSN_CACHE): Provide inlined definition directly. libgcc/ChangeLog * config/tilepro/atomic.h: Do not include arch/spr_def.h and asm/unistd.h. (SPR_CMPEXCH_VALUE): Define for tilegx. (__NR_FAST_cmpxchg): Define for tilepro. (__NR_FAST_atomic_update): Define for tilepro. (__NR_FAST_cmpxchg64): Define for tilepro. From-SVN: r237824 --- gcc/ChangeLog | 7 +++++++ gcc/config/tilegx/linux.h | 19 +++++++++++++++---- gcc/config/tilepro/linux.h | 29 ++++++++++++++++++++++++----- libgcc/ChangeLog | 9 +++++++++ libgcc/config/tilepro/atomic.h | 6 ++++-- 5 files changed, 59 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9d41ad9ec1..cc515b733ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-28 Walter Lee + + * config/tilegx/linux.h: Do not include arch/icache.h + (CLEAR_INSN_CACHE): Provide inlined definition directly. + * config/tilepro/linux.h: Do not include arch/icache.h + (CLEAR_INSN_CACHE): Provide inlined definition directly. + 2016-06-28 Wilco Dijkstra * tree-ssa-math-opts.c (find_bswap_or_nop_1): Adjust bitnumbering diff --git a/gcc/config/tilegx/linux.h b/gcc/config/tilegx/linux.h index f68b044da13..8ed3d028568 100644 --- a/gcc/config/tilegx/linux.h +++ b/gcc/config/tilegx/linux.h @@ -55,12 +55,23 @@ /* For __clear_cache in libgcc2.c. */ #ifdef IN_LIBGCC2 -#include - /* Use the minimum page size of 4K. Alternatively we can call - getpagesize() but it introduces a libc dependence. */ + getpagesize() but it introduces a libc dependence. + See Linux arch/tile/include/uapi/arch/icache.h for more commentary. */ #undef CLEAR_INSN_CACHE -#define CLEAR_INSN_CACHE(beg, end) invalidate_icache (beg, end - beg, 4096) +#define CLEAR_INSN_CACHE(BEG, END) \ +{ \ + long size = (long) (END) - (long) (BEG); \ + if (size) \ + { \ + const char *p = (const char *) ((unsigned long) (BEG) & -64L); \ + const char *end = p + (size < 4096 ? size : 4096) - 1; \ + __insn_mf (); \ + for (; p <= end; p += 64) \ + __insn_icoh (p); \ + __insn_drain (); \ + } \ +} #else diff --git a/gcc/config/tilepro/linux.h b/gcc/config/tilepro/linux.h index c7791f92de0..ebe15f4cc91 100644 --- a/gcc/config/tilepro/linux.h +++ b/gcc/config/tilepro/linux.h @@ -47,12 +47,31 @@ /* For __clear_cache in libgcc2.c. */ #ifdef IN_LIBGCC2 -#include - -/* Use the minimum page size of 4K. Alternatively we can call getpagesize() - but it introduces a libc dependence. */ +/* Use the minimum page size of 4K. Alternatively we can call + getpagesize() but it introduces a libc dependence. + See Linux arch/tile/include/uapi/arch/icache.h for more commentary. */ #undef CLEAR_INSN_CACHE -#define CLEAR_INSN_CACHE(beg, end) invalidate_icache (beg, end - beg, 4096) +#define CLEAR_INSN_CACHE(BEG, END) \ +{ \ + long size = (long) (END) - (long) (BEG); \ + if (size) \ + { \ + const char *start = (const char *) ((unsigned long) (BEG) & -64L);\ + const char *end = start + (size < 16384 ? size : 16384) - 1; \ + long num_passes = 4; \ + __insn_mf (); \ + do \ + { \ + const char *p; \ + for (p = start; p <= end; p += 64) \ + __insn_icoh (p); \ + start += 4096; \ + end += 4096; \ + } \ + while (--num_passes > 0); \ + __insn_drain (); \ + } \ +} #else diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index db5616ab720..8f758e39e11 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2016-06-28 Walter Lee + + * config/tilepro/atomic.h: Do not include arch/spr_def.h and + asm/unistd.h. + (SPR_CMPEXCH_VALUE): Define for tilegx. + (__NR_FAST_cmpxchg): Define for tilepro. + (__NR_FAST_atomic_update): Define for tilepro. + (__NR_FAST_cmpxchg64): Define for tilepro. + 2016-06-23 Jakub Sejdak * config.host: Add suport for arm*-*-phoenix* targets. diff --git a/libgcc/config/tilepro/atomic.h b/libgcc/config/tilepro/atomic.h index 78fa9a9df5d..6abe6e14362 100644 --- a/libgcc/config/tilepro/atomic.h +++ b/libgcc/config/tilepro/atomic.h @@ -93,9 +93,11 @@ #endif #ifdef __tilegx__ -#include +#define SPR_CMPEXCH_VALUE 0x2780 #else -#include +#define __NR_FAST_cmpxchg -1 +#define __NR_FAST_atomic_update -2 +#define __NR_FAST_cmpxchg64 -3 #endif -- 2.30.2