linux.h: Do not include arch/icache.h
authorWalter Lee <walt@tilera.com>
Tue, 28 Jun 2016 16:20:58 +0000 (16:20 +0000)
committerWalter Lee <walt@gcc.gnu.org>
Tue, 28 Jun 2016 16:20:58 +0000 (16:20 +0000)
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
gcc/config/tilegx/linux.h
gcc/config/tilepro/linux.h
libgcc/ChangeLog
libgcc/config/tilepro/atomic.h

index d9d41ad9ec1cdaaa81c76e3e6c09d6ce79f1d5c4..cc515b733ab3c9e499d8a529a4056424846aa0f0 100644 (file)
@@ -1,3 +1,10 @@
+2016-06-28  Walter Lee  <walt@tilera.com>
+
+       * 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  <wdijkstr@arm.com>
 
        * tree-ssa-math-opts.c (find_bswap_or_nop_1): Adjust bitnumbering
index f68b044da13fddab31359c59602a19c3b3c98f70..8ed3d028568d6b7277c726a7165f45679aa34d40 100644 (file)
 /* For __clear_cache in libgcc2.c.  */
 #ifdef IN_LIBGCC2
 
-#include <arch/icache.h>
-
 /* 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
 
index c7791f92de050f8f78bddd2938d0d67bc8d55504..ebe15f4cc91c5e8218d6298893c49e4a72dd2054 100644 (file)
 /* For __clear_cache in libgcc2.c.  */
 #ifdef IN_LIBGCC2
 
-#include <arch/icache.h>
-
-/* 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
 
index db5616ab720d94b07c5352b39c8a3ae36c3f9219..8f758e39e11a92df5f91346e53c667c3644a1c1c 100644 (file)
@@ -1,3 +1,12 @@
+2016-06-28  Walter Lee  <walt@tilera.com>
+
+       * 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  <jakub.sejdak@phoesys.com>
 
    * config.host: Add suport for arm*-*-phoenix* targets.
index 78fa9a9df5d8ed8065ca7215e08c665dadab496d..6abe6e143621a65843e724c236a6522941d451b6 100644 (file)
 #endif
 
 #ifdef __tilegx__
-#include <arch/spr_def.h>
+#define SPR_CMPEXCH_VALUE 0x2780
 #else
-#include <asm/unistd.h>
+#define __NR_FAST_cmpxchg      -1
+#define __NR_FAST_atomic_update        -2
+#define __NR_FAST_cmpxchg64    -3
 #endif