diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-06 08:50:12 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-06 08:50:12 +0000 |
commit | 8992df51cbb8c833d37770b28547b157523a92b7 (patch) | |
tree | 0edeb5eefb9376aad7c7391332316f9d2fd7e437 /libgcc/config | |
parent | 8173baf5feae49224e485ad85a5f34d468be531f (diff) | |
download | gcc-8992df51cbb8c833d37770b28547b157523a92b7.tar.gz |
* configure.ac: Add Visium support.
* configure: Regenerate.
libgcc/
* config.host: Add Visium support.
* config/visium: New directory.
gcc/
* config.gcc: Add Visium support.
* configure.ac: Likewise.
* configure: Regenerate.
* doc/extend.texi (interrupt attribute): Add Visium.
* doc/invoke.texi: Document Visium options.
* doc/install.texi: Document Visium target.
* doc/md.texi: Document Visium constraints.
* common/config/visium: New directory.
* config/visium: Likewise.
gcc/testsuite/
* lib/target-supports.exp (check_profiling_available): Return 0 for
Visium.
(check_effective_target_tls_runtime): Likewise.
(check_effective_target_logical_op_short_circuit): Return 1 for Visium.
* gcc.dg/20020312-2.c: Adjust for Visium.
* gcc.dg/tls/thr-cse-1.c: Likewise
* gcc.dg/tree-ssa/20040204-1.c: Likewise
* gcc.dg/tree-ssa/loop-1.c: Likewise.
* gcc.dg/weak/typeof-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/config')
-rw-r--r-- | libgcc/config/visium/crti.S | 46 | ||||
-rw-r--r-- | libgcc/config/visium/crtn.S | 40 | ||||
-rw-r--r-- | libgcc/config/visium/divdi3.c | 25 | ||||
-rw-r--r-- | libgcc/config/visium/lib2funcs.c | 323 | ||||
-rw-r--r-- | libgcc/config/visium/memcpy.c | 862 | ||||
-rw-r--r-- | libgcc/config/visium/memcpy.h | 33 | ||||
-rw-r--r-- | libgcc/config/visium/memset.c | 664 | ||||
-rw-r--r-- | libgcc/config/visium/memset.h | 33 | ||||
-rw-r--r-- | libgcc/config/visium/moddi3.c | 25 | ||||
-rw-r--r-- | libgcc/config/visium/set_trampoline_parity.c | 25 | ||||
-rw-r--r-- | libgcc/config/visium/t-visium | 29 | ||||
-rw-r--r-- | libgcc/config/visium/udivdi3.c | 25 | ||||
-rw-r--r-- | libgcc/config/visium/udivmoddi4.c | 25 | ||||
-rw-r--r-- | libgcc/config/visium/umoddi3.c | 25 |
14 files changed, 2180 insertions, 0 deletions
diff --git a/libgcc/config/visium/crti.S b/libgcc/config/visium/crti.S new file mode 100644 index 00000000000..158ae0f3261 --- /dev/null +++ b/libgcc/config/visium/crti.S @@ -0,0 +1,46 @@ +/* crti.S for Visium. + Copyright (C) 2005-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + + .file "crti.o" + .ident "GNU C crti.o" + + .section .init + .globl __init + .type __init,@function +__init: + subi r23,8 + nop + write.l (r23),r22 + write.l 1(r23),r21 + move.l r22,r23 + + .section .fini + .globl __fini + .type __fini,@function +__fini: + subi r23,8 + nop + write.l (r23),r22 + write.l 1(r23),r21 + move.l r22,r23 diff --git a/libgcc/config/visium/crtn.S b/libgcc/config/visium/crtn.S new file mode 100644 index 00000000000..a60f4de021e --- /dev/null +++ b/libgcc/config/visium/crtn.S @@ -0,0 +1,40 @@ +/* crtn.S for Visium. + Copyright (C) 2005-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + + .file "crtn.o" + .ident "GNU C crtn.o" + + .section .init + move.l r23,r22 + read.l r22,(r22) + read.l r21,1(r23) + bra tr,r21,r0 + addi r23,8 + + .section .fini + move.l r23,r22 + read.l r22,(r22) + read.l r21,1(r23) + bra tr,r21,r0 + addi r23,8 diff --git a/libgcc/config/visium/divdi3.c b/libgcc/config/visium/divdi3.c new file mode 100644 index 00000000000..38b747a9865 --- /dev/null +++ b/libgcc/config/visium/divdi3.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_divdi3 +#include "lib2funcs.c" diff --git a/libgcc/config/visium/lib2funcs.c b/libgcc/config/visium/lib2funcs.c new file mode 100644 index 00000000000..ba720a36d9e --- /dev/null +++ b/libgcc/config/visium/lib2funcs.c @@ -0,0 +1,323 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "tconfig.h" +#include "tsystem.h" +#include "coretypes.h" +#include "tm.h" +#include "libgcc_tm.h" + +#ifdef HAVE_GAS_HIDDEN +#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) +#else +#define ATTRIBUTE_HIDDEN +#endif + +/* Work out the largest "word" size that we can deal with on this target. */ +#if MIN_UNITS_PER_WORD > 4 +# define LIBGCC2_MAX_UNITS_PER_WORD 8 +#elif (MIN_UNITS_PER_WORD > 2 \ + || (MIN_UNITS_PER_WORD > 1 && __SIZEOF_LONG_LONG__ > 4)) +# define LIBGCC2_MAX_UNITS_PER_WORD 4 +#else +# define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD +#endif + +/* Work out what word size we are using for this compilation. + The value can be set on the command line. */ +#ifndef LIBGCC2_UNITS_PER_WORD +#define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD +#endif + +#if LIBGCC2_UNITS_PER_WORD <= LIBGCC2_MAX_UNITS_PER_WORD + +#include "libgcc2.h" + +/* umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two + UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype + word product in HIGH_PROD and LOW_PROD. */ + +#undef umul_ppmm +#define umul_ppmm(wh, wl, u, v) \ + do { \ + /* Generate multu instruction. */ \ + UDWtype __t = (UDWtype)(u) * (UDWtype)(v); \ + (wl) = (UWtype)__t; \ + (wh) = (UWtype)(__t >> W_TYPE_SIZE); \ + } while (0) + +/* sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, + high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, + composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and + LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE + and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, + and is lost. */ + +#undef sub_ddmmss +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub.l %0,%2,%4\n\t" \ + "subc.l %1,%3,%5" \ + : "=&r" (sl), "=r" (sh) \ + : "r" (al), "r" (ah), "r" (bl), "r" (bh)) + +/* udiv_qqrnnd(high_quotient, low_quotient, remainder, high_numerator, + low_numerator, denominator) divides a UDWtype, composed by the UWtype + HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient + in QUOTIENT and the remainder in REMAINDER. */ + +#define udiv_qqrnnd(qh, ql, r, nh, nl, d) \ + __asm__ ("writemd %3,%4\n\t" \ + "divdu %5\n\t" \ + "readmda %0\n\t" \ + "readmdb %1\n\t" \ + "readmdc %2" \ + : "=r" (ql), "=r" (qh), "=r" (r) \ + : "r" (nl), "r" (nh), "r" (d) \ + : "mdb", "mdc") + +#if (defined (L_udivdi3) || defined (L_divdi3) || \ + defined (L_umoddi3) || defined (L_moddi3)) +#define L_udivmoddi4 +#endif + +#ifdef L_udivmoddi4 + +#if (defined (L_udivdi3) || defined (L_divdi3) || \ + defined (L_umoddi3) || defined (L_moddi3)) +static inline __attribute__ ((__always_inline__)) +#endif +UDWtype +__udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) +{ + const DWunion nn = {.ll = n}; + const DWunion dd = {.ll = d}; + DWunion rr; + UWtype d0, d1, n0, n1, n2; + UWtype q0, q1; + UWtype b, bm; + + d0 = dd.s.low; + d1 = dd.s.high; + n0 = nn.s.low; + n1 = nn.s.high; + + if (d1 == 0) + { + /* qq = NN / 0d */ + + if (d0 == 0) + d0 = 1 / d0; /* Divide intentionally by zero. */ + + udiv_qqrnnd (q1, q0, n0, n1, n0, d0); + + /* Remainder in n0. */ + + if (rp != 0) + { + rr.s.low = n0; + rr.s.high = 0; + *rp = rr.ll; + } + } + + else + { + if (d1 > n1) + { + /* 00 = nn / DD */ + + q0 = 0; + q1 = 0; + + /* Remainder in n1n0. */ + if (rp != 0) + { + rr.s.low = n0; + rr.s.high = n1; + *rp = rr.ll; + } + } + else + { + /* 0q = NN / dd */ + + count_leading_zeros (bm, d1); + if (bm == 0) + { + /* From (n1 >= d1) /\ (the most significant bit of d1 is set), + conclude (the most significant bit of n1 is set) /\ (the + quotient digit q0 = 0 or 1). + + This special case is necessary, not an optimization. */ + + /* The condition on the next line takes advantage of that + n1 >= d1 (true due to program flow). */ + if (n1 > d1 || n0 >= d0) + { + q0 = 1; + sub_ddmmss (n1, n0, n1, n0, d1, d0); + } + else + q0 = 0; + + q1 = 0; + + if (rp != 0) + { + rr.s.low = n0; + rr.s.high = n1; + *rp = rr.ll; + } + } + else + { + UWtype m1, m0; + /* Normalize. */ + + b = W_TYPE_SIZE - bm; + + d1 = (d1 << bm) | (d0 >> b); + d0 = d0 << bm; + n2 = n1 >> b; + n1 = (n1 << bm) | (n0 >> b); + n0 = n0 << bm; + + udiv_qqrnnd (q1, q0, n1, n2, n1, d1); + umul_ppmm (m1, m0, q0, d0); + + if (m1 > n1 || (m1 == n1 && m0 > n0)) + { + q0--; + sub_ddmmss (m1, m0, m1, m0, d1, d0); + } + + /* Remainder in (n1n0 - m1m0) >> bm. */ + if (rp != 0) + { + sub_ddmmss (n1, n0, n1, n0, m1, m0); + rr.s.low = (n1 << b) | (n0 >> bm); + rr.s.high = n1 >> bm; + *rp = rr.ll; + } + } + } + } + + const DWunion ww = {{.low = q0, .high = q1}}; + return ww.ll; +} +#endif + +#ifdef L_divdi3 +DWtype +__divdi3 (DWtype u, DWtype v) +{ + Wtype c = 0; + DWunion uu = {.ll = u}; + DWunion vv = {.ll = v}; + DWtype w; + + if (uu.s.high < 0) + c = ~c, + uu.ll = -uu.ll; + if (vv.s.high < 0) + c = ~c, + vv.ll = -vv.ll; + + w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0); + if (c) + w = -w; + + return w; +} +#endif + +#ifdef L_moddi3 +DWtype +__moddi3 (DWtype u, DWtype v) +{ + Wtype c = 0; + DWunion uu = {.ll = u}; + DWunion vv = {.ll = v}; + DWtype w; + + if (uu.s.high < 0) + c = ~c, + uu.ll = -uu.ll; + if (vv.s.high < 0) + vv.ll = -vv.ll; + + (void) __udivmoddi4 (uu.ll, vv.ll, (UDWtype*)&w); + if (c) + w = -w; + + return w; +} +#endif + +#ifdef L_umoddi3 +UDWtype +__umoddi3 (UDWtype u, UDWtype v) +{ + UDWtype w; + + (void) __udivmoddi4 (u, v, &w); + + return w; +} +#endif + +#ifdef L_udivdi3 +UDWtype +__udivdi3 (UDWtype n, UDWtype d) +{ + return __udivmoddi4 (n, d, (UDWtype *) 0); +} +#endif + +#ifdef L_set_trampoline_parity +#undef int +extern void __set_trampoline_parity (UWtype *); + +static inline UWtype +parity_bit (UWtype x) +{ + x ^= x << 16; + x ^= x << 8; + x ^= x << 4; + x ^= x << 2; + x ^= x << 1; + return x & ((UWtype) 1 << (W_TYPE_SIZE - 1)); +} + +void +__set_trampoline_parity (UWtype *addr) +{ + int i; + + for (i = 0; i < (TRAMPOLINE_SIZE * BITS_PER_UNIT) / W_TYPE_SIZE; i++) + addr[i] |= parity_bit (addr[i]); +} +#endif + +#endif /* LIBGCC2_UNITS_PER_WORD <= MIN_UNITS_PER_WORD */ diff --git a/libgcc/config/visium/memcpy.c b/libgcc/config/visium/memcpy.c new file mode 100644 index 00000000000..21efdd0f77b --- /dev/null +++ b/libgcc/config/visium/memcpy.c @@ -0,0 +1,862 @@ +/* Copyright (C) 2012-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* This file must be kept in sync with newlib/libc/machine/visium/memcpy.c */ + +#include <stddef.h> +#include "memcpy.h" + +#define INST_BARRIER __asm__ __volatile__ ("":::"memory"); + +#define MOVE_32_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + m0 = in [8]; \ + m1 = in [9]; \ + m2 = in [10]; \ + m3 = in [11]; \ + out [8] = m0; \ + out [9] = m1; \ + out [10] = m2; \ + out [11] = m3; \ + INST_BARRIER \ + m0 = in [12]; \ + m1 = in [13]; \ + m2 = in [14]; \ + m3 = in [15]; \ + out [12] = m0; \ + out [13] = m1; \ + out [14] = m2; \ + out [15] = m3; \ + INST_BARRIER \ + m0 = in [16]; \ + m1 = in [17]; \ + m2 = in [18]; \ + m3 = in [19]; \ + out [16] = m0; \ + out [17] = m1; \ + out [18] = m2; \ + out [19] = m3; \ + INST_BARRIER \ + m0 = in [20]; \ + m1 = in [21]; \ + m2 = in [22]; \ + m3 = in [23]; \ + out [20] = m0; \ + out [21] = m1; \ + out [22] = m2; \ + out [23] = m3; \ + INST_BARRIER \ + m0 = in [24]; \ + m1 = in [25]; \ + m2 = in [26]; \ + m3 = in [27]; \ + out [24] = m0; \ + out [25] = m1; \ + out [26] = m2; \ + out [27] = m3; \ + INST_BARRIER \ + m0 = in [28]; \ + m1 = in [29]; \ + m2 = in [30]; \ + m3 = in [31]; \ + out [28] = m0; \ + out [29] = m1; \ + out [30] = m2; \ + out [31] = m3; \ + INST_BARRIER \ + in += 32; \ + out += 32; \ +} while(0) + +#define MOVE_16_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + m0 = in [8]; \ + m1 = in [9]; \ + m2 = in [10]; \ + m3 = in [11]; \ + out [8] = m0; \ + out [9] = m1; \ + out [10] = m2; \ + out [11] = m3; \ + INST_BARRIER \ + m0 = in [12]; \ + m1 = in [13]; \ + m2 = in [14]; \ + m3 = in [15]; \ + out [12] = m0; \ + out [13] = m1; \ + out [14] = m2; \ + out [15] = m3; \ + INST_BARRIER \ + in += 16; \ + out += 16; \ +} while(0) + +#define MOVE_12_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + m0 = in [8]; \ + m1 = in [9]; \ + m2 = in [10]; \ + m3 = in [11]; \ + out [8] = m0; \ + out [9] = m1; \ + out [10] = m2; \ + out [11] = m3; \ + INST_BARRIER \ + in += 12; \ + out += 12; \ +} while(0) + +#define MOVE_11_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + m0 = in [8]; \ + m1 = in [9]; \ + m2 = in [10]; \ + out [8] = m0; \ + out [9] = m1; \ + out [10] = m2; \ + INST_BARRIER \ + in += 11; \ + out += 11; \ +} while(0) + +#define MOVE_10_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + m0 = in [8]; \ + out [5] = m1; \ + m1 = in [9]; \ + out [6] = m2; \ + out [7] = m3; \ + out [8] = m0; \ + out [9] = m1; \ + INST_BARRIER \ + in += 10; \ + out += 10; \ +} while(0) + +#define MOVE_9_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + m0 = in [8]; \ + out [8] = m0; \ + in += 9; \ + out += 9; \ +} while(0) + +#define MOVE_8_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + m3 = in [7]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + out [7] = m3; \ + INST_BARRIER \ + in += 8; \ + out += 8; \ +} while(0) + +#define MOVE_7_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + m0 = in [4]; \ + m1 = in [5]; \ + m2 = in [6]; \ + out [4] = m0; \ + out [5] = m1; \ + out [6] = m2; \ + INST_BARRIER \ + in += 7; \ + out += 7; \ +} while(0) + +#define MOVE_6_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + INST_BARRIER \ + m0 = in [4]; \ + out [1] = m1; \ + INST_BARRIER \ + m1 = in [5]; \ + out [2] = m2; \ + out [3] = m3; \ + out [4] = m0; \ + out [5] = m1; \ + INST_BARRIER \ + in += 6; \ + out += 6; \ +} while(0) + +#define MOVE_5_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + INST_BARRIER \ + out [0] = m0; \ + m0 = in [4]; \ + INST_BARRIER \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + out [4] = m0; \ + INST_BARRIER \ + in += 5; \ + out += 5; \ +} while(0) + +#define MOVE_4_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + m3 = in [3]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + out [3] = m3; \ + INST_BARRIER \ + in += 4; \ + out += 4; \ +} while(0) + +#define MOVE_3_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + m2 = in [2]; \ + out [0] = m0; \ + out [1] = m1; \ + out [2] = m2; \ + INST_BARRIER \ + in += 3; \ + out += 3; \ +} while(0) + +#define MOVE_2_OBJECTS(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + m1 = in [1]; \ + out [0] = m0; \ + out [1] = m1; \ + INST_BARRIER \ + in += 2; \ + out += 2; \ +} while(0) + +#define MOVE_1_OBJECT(in,out) \ +do { \ + INST_BARRIER \ + m0 = in [0]; \ + out [0] = m0; \ + INST_BARRIER \ + in += 1; \ + out += 1; \ +} while(0) + + +static inline void +__int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + int value = n; + int loop_var; + const int *in = s2; + int *out = s1; + int count; + int m0,m1,m2,m3; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + MOVE_1_OBJECT (in, out); + break; + case 2: + MOVE_2_OBJECTS (in, out); + break; + case 3: + MOVE_3_OBJECTS (in, out); + break; + case 4: + MOVE_4_OBJECTS (in, out); + break; + case 5: + MOVE_5_OBJECTS (in, out); + break; + case 6: + MOVE_6_OBJECTS (in, out); + break; + case 7: + MOVE_7_OBJECTS (in, out); + break; + case 8: + MOVE_8_OBJECTS (in, out); + break; + case 9: + MOVE_9_OBJECTS (in, out); + break; + case 10: + MOVE_10_OBJECTS (in, out); + break; + case 11: + MOVE_11_OBJECTS (in, out); + break; + case 12: + MOVE_12_OBJECTS (in, out); + break; + case 13: + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 14: + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 15: + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 16: + MOVE_16_OBJECTS (in, out); + break; + case 17: + MOVE_11_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 18: + MOVE_9_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 19: + MOVE_16_OBJECTS (in, out); + MOVE_3_OBJECTS (in, out); + break; + case 20: + MOVE_16_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 21: + MOVE_16_OBJECTS (in, out); + MOVE_5_OBJECTS (in, out); + break; + case 22: + MOVE_16_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 23: + MOVE_16_OBJECTS (in, out); + MOVE_7_OBJECTS (in, out); + break; + case 24: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + break; + case 25: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 26: + MOVE_16_OBJECTS (in, out); + MOVE_10_OBJECTS (in, out); + break; + case 27: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + break; + case 28: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 29: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 30: + MOVE_16_OBJECTS (in, out); + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 31: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + MOVE_32_OBJECTS (in, out); +} + +static inline void +__shrt_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + int value = n; + int loop_var; + const short int *in = s2; + int short *out = s1; + int count; + int m0,m1,m2,m3; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + MOVE_1_OBJECT (in, out); + break; + case 2: + MOVE_2_OBJECTS (in, out); + break; + case 3: + MOVE_3_OBJECTS (in, out); + break; + case 4: + MOVE_4_OBJECTS (in, out); + break; + case 5: + MOVE_5_OBJECTS (in, out); + break; + case 6: + MOVE_6_OBJECTS (in, out); + break; + case 7: + MOVE_7_OBJECTS (in, out); + break; + case 8: + MOVE_8_OBJECTS (in, out); + break; + case 9: + MOVE_9_OBJECTS (in, out); + break; + case 10: + MOVE_10_OBJECTS (in, out); + break; + case 11: + MOVE_11_OBJECTS (in, out); + break; + case 12: + MOVE_12_OBJECTS (in, out); + break; + case 13: + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 14: + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 15: + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 16: + MOVE_16_OBJECTS (in, out); + break; + case 17: + MOVE_11_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 18: + MOVE_9_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 19: + MOVE_16_OBJECTS (in, out); + MOVE_3_OBJECTS (in, out); + break; + case 20: + MOVE_16_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 21: + MOVE_16_OBJECTS (in, out); + MOVE_5_OBJECTS (in, out); + break; + case 22: + MOVE_16_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 23: + MOVE_16_OBJECTS (in, out); + MOVE_7_OBJECTS (in, out); + break; + case 24: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + break; + case 25: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 26: + MOVE_16_OBJECTS (in, out); + MOVE_10_OBJECTS (in, out); + break; + case 27: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + break; + case 28: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 29: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 30: + MOVE_16_OBJECTS (in, out); + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 31: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + MOVE_32_OBJECTS (in, out); +} + + +static inline void +__byte_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + int value = n; + int loop_var; + const char *in = s2; + char *out = s1; + int count; + int m0,m1,m2,m3; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + MOVE_1_OBJECT (in, out); + break; + case 2: + MOVE_2_OBJECTS (in, out); + break; + case 3: + MOVE_3_OBJECTS (in, out); + break; + case 4: + MOVE_4_OBJECTS (in, out); + break; + case 5: + MOVE_5_OBJECTS (in, out); + break; + case 6: + MOVE_6_OBJECTS (in, out); + break; + case 7: + MOVE_7_OBJECTS (in, out); + break; + case 8: + MOVE_8_OBJECTS (in, out); + break; + case 9: + MOVE_9_OBJECTS (in, out); + break; + case 10: + MOVE_10_OBJECTS (in, out); + break; + case 11: + MOVE_11_OBJECTS (in, out); + break; + case 12: + MOVE_12_OBJECTS (in, out); + break; + case 13: + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 14: + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 15: + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 16: + MOVE_16_OBJECTS (in, out); + break; + case 17: + MOVE_11_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 18: + MOVE_9_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 19: + MOVE_16_OBJECTS (in, out); + MOVE_3_OBJECTS (in, out); + break; + case 20: + MOVE_16_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 21: + MOVE_16_OBJECTS (in, out); + MOVE_5_OBJECTS (in, out); + break; + case 22: + MOVE_16_OBJECTS (in, out); + MOVE_6_OBJECTS (in, out); + break; + case 23: + MOVE_16_OBJECTS (in, out); + MOVE_7_OBJECTS (in, out); + break; + case 24: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + break; + case 25: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + break; + case 26: + MOVE_16_OBJECTS (in, out); + MOVE_10_OBJECTS (in, out); + break; + case 27: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + break; + case 28: + MOVE_16_OBJECTS (in, out); + MOVE_8_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 29: + MOVE_16_OBJECTS (in, out); + MOVE_9_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + case 30: + MOVE_16_OBJECTS (in, out); + MOVE_12_OBJECTS (in, out); + MOVE_2_OBJECTS (in, out); + break; + case 31: + MOVE_16_OBJECTS (in, out); + MOVE_11_OBJECTS (in, out); + MOVE_4_OBJECTS (in, out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + MOVE_32_OBJECTS (in, out); +} + + +/* Exposed interface. */ + +#ifndef __VISIUM_ARCH_BMI__ + +void +__long_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + __int_memcpy (s1, s2, n); +} + +#endif /* !__VISIUM_ARCH_BMI__ */ + +void +__wrd_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + __shrt_int_memcpy (s1, s2, n); +} + +void +__byt_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) +{ + __byte_memcpy (s1, s2, n); +} diff --git a/libgcc/config/visium/memcpy.h b/libgcc/config/visium/memcpy.h new file mode 100644 index 00000000000..5df81763fb5 --- /dev/null +++ b/libgcc/config/visium/memcpy.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2012-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* Specialized variants of memcpy called directly from compiled code. */ + +extern void +__long_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n); + +extern void +__wrd_memcpy (void *__restrict s1, const void *__restrict s2, size_t n); + +extern void +__byt_memcpy (void *__restrict s1, const void *__restrict s2, size_t n); diff --git a/libgcc/config/visium/memset.c b/libgcc/config/visium/memset.c new file mode 100644 index 00000000000..5f81679fddc --- /dev/null +++ b/libgcc/config/visium/memset.c @@ -0,0 +1,664 @@ +/* Copyright (C) 2012-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* This file must be kept in sync with newlib/libc/machine/visium/memset.c */ + +#include <stddef.h> +#include "memset.h" + +#define SET_32_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out [9] = m0; \ + out [10] = m0; \ + out [11] = m0; \ + out [12] = m0; \ + out [13] = m0; \ + out [14] = m0; \ + out [15] = m0; \ + out [16] = m0; \ + out [17] = m0; \ + out [18] = m0; \ + out [19] = m0; \ + out [20] = m0; \ + out [21] = m0; \ + out [22] = m0; \ + out [23] = m0; \ + out [24] = m0; \ + out [25] = m0; \ + out [26] = m0; \ + out [27] = m0; \ + out [28] = m0; \ + out [29] = m0; \ + out [30] = m0; \ + out [31] = m0; \ + out += 32; \ +} while(0) + +#define SET_16_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out [9] = m0; \ + out [10] = m0; \ + out [11] = m0; \ + out [12] = m0; \ + out [13] = m0; \ + out [14] = m0; \ + out [15] = m0; \ + out += 16; \ +} while(0) + +#define SET_12_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out [9] = m0; \ + out [10] = m0; \ + out [11] = m0; \ + out += 12; \ +} while(0) + +#define SET_11_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out [9] = m0; \ + out [10] = m0; \ + out += 11; \ +} while(0) + +#define SET_10_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out [9] = m0; \ + out += 10; \ +} while(0) + +#define SET_9_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out [8] = m0; \ + out += 9; \ +} while(0) + +#define SET_8_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out [7] = m0; \ + out += 8; \ +} while(0) + +#define SET_7_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out [6] = m0; \ + out += 7; \ +} while(0) + +#define SET_6_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out [5] = m0; \ + out += 6; \ +} while(0) + +#define SET_5_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out [4] = m0; \ + out += 5; \ +} while(0) + +#define SET_4_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out [3] = m0; \ + out += 4; \ +} while(0) + +#define SET_3_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out [2] = m0; \ + out += 3; \ +} while(0) + +#define SET_2_OBJECTS(out) \ +do { \ + out [0] = m0; \ + out [1] = m0; \ + out += 2; \ +} while(0) + +#define SET_1_OBJECT(out) \ +do { \ + out [0] = m0; \ + out += 1; \ +} while(0) + + +static inline void +__int_memset (void *__restrict s1, int val, size_t n) +{ + int value = n; + int loop_var; + int *out = s1; + int count; + int m0 = val; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + SET_1_OBJECT (out); + break; + case 2: + SET_2_OBJECTS (out); + break; + case 3: + SET_3_OBJECTS (out); + break; + case 4: + SET_4_OBJECTS (out); + break; + case 5: + SET_5_OBJECTS (out); + break; + case 6: + SET_6_OBJECTS (out); + break; + case 7: + SET_7_OBJECTS (out); + break; + case 8: + SET_8_OBJECTS (out); + break; + case 9: + SET_9_OBJECTS (out); + break; + case 10: + SET_10_OBJECTS (out); + break; + case 11: + SET_11_OBJECTS (out); + break; + case 12: + SET_12_OBJECTS (out); + break; + case 13: + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 14: + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 15: + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 16: + SET_16_OBJECTS (out); + break; + case 17: + SET_11_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 18: + SET_9_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 19: + SET_16_OBJECTS (out); + SET_3_OBJECTS (out); + break; + case 20: + SET_16_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 21: + SET_16_OBJECTS (out); + SET_5_OBJECTS (out); + break; + case 22: + SET_16_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 23: + SET_16_OBJECTS (out); + SET_7_OBJECTS (out); + break; + case 24: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + break; + case 25: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 26: + SET_16_OBJECTS (out); + SET_10_OBJECTS (out); + break; + case 27: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + break; + case 28: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 29: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 30: + SET_16_OBJECTS (out); + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 31: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + SET_32_OBJECTS (out); +} + +static inline void +__short_int_memset (void *__restrict s1, int val, size_t n) +{ + int value = n; + int loop_var; + int short *out = s1; + int count; + int m0 = val; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + SET_1_OBJECT (out); + break; + case 2: + SET_2_OBJECTS (out); + break; + case 3: + SET_3_OBJECTS (out); + break; + case 4: + SET_4_OBJECTS (out); + break; + case 5: + SET_5_OBJECTS (out); + break; + case 6: + SET_6_OBJECTS (out); + break; + case 7: + SET_7_OBJECTS (out); + break; + case 8: + SET_8_OBJECTS (out); + break; + case 9: + SET_9_OBJECTS (out); + break; + case 10: + SET_10_OBJECTS (out); + break; + case 11: + SET_11_OBJECTS (out); + break; + case 12: + SET_12_OBJECTS (out); + break; + case 13: + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 14: + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 15: + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 16: + SET_16_OBJECTS (out); + break; + case 17: + SET_11_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 18: + SET_9_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 19: + SET_16_OBJECTS (out); + SET_3_OBJECTS (out); + break; + case 20: + SET_16_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 21: + SET_16_OBJECTS (out); + SET_5_OBJECTS (out); + break; + case 22: + SET_16_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 23: + SET_16_OBJECTS (out); + SET_7_OBJECTS (out); + break; + case 24: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + break; + case 25: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 26: + SET_16_OBJECTS (out); + SET_10_OBJECTS (out); + break; + case 27: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + break; + case 28: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 29: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 30: + SET_16_OBJECTS (out); + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 31: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + SET_32_OBJECTS (out); +} + +static inline void +__byte_memset (void *__restrict s1, int val, size_t n) +{ + int value = n; + int loop_var; + char *out = s1; + int count; + int m0 = val; + + /* This code currently give a stall for any value with a 1->2 in the low 5 + bits, i.e. 1,2, 33,34 ? not acceptable! */ + switch (value & 0x1f) + { + case 0: + break; + case 1: + SET_1_OBJECT (out); + break; + case 2: + SET_2_OBJECTS (out); + break; + case 3: + SET_3_OBJECTS (out); + break; + case 4: + SET_4_OBJECTS (out); + break; + case 5: + SET_5_OBJECTS (out); + break; + case 6: + SET_6_OBJECTS (out); + break; + case 7: + SET_7_OBJECTS (out); + break; + case 8: + SET_8_OBJECTS (out); + break; + case 9: + SET_9_OBJECTS (out); + break; + case 10: + SET_10_OBJECTS (out); + break; + case 11: + SET_11_OBJECTS (out); + break; + case 12: + SET_12_OBJECTS (out); + break; + case 13: + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 14: + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 15: + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 16: + SET_16_OBJECTS (out); + break; + case 17: + SET_11_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 18: + SET_9_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 19: + SET_16_OBJECTS (out); + SET_3_OBJECTS (out); + break; + case 20: + SET_16_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 21: + SET_16_OBJECTS (out); + SET_5_OBJECTS (out); + break; + case 22: + SET_16_OBJECTS (out); + SET_6_OBJECTS (out); + break; + case 23: + SET_16_OBJECTS (out); + SET_7_OBJECTS (out); + break; + case 24: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + break; + case 25: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + break; + case 26: + SET_16_OBJECTS (out); + SET_10_OBJECTS (out); + break; + case 27: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + break; + case 28: + SET_16_OBJECTS (out); + SET_8_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 29: + SET_16_OBJECTS (out); + SET_9_OBJECTS (out); + SET_4_OBJECTS (out); + break; + case 30: + SET_16_OBJECTS (out); + SET_12_OBJECTS (out); + SET_2_OBJECTS (out); + break; + case 31: + SET_16_OBJECTS (out); + SET_11_OBJECTS (out); + SET_4_OBJECTS (out); + break; + } + + /* This loop governs the asmptoptic behaviour of this algorithm, for long + word copies. */ + count = value >> 5; + for (loop_var = 0; loop_var < count; loop_var++) + SET_32_OBJECTS (out); +} + + +/* Exposed interface. */ + +void +__long_int_memset (void *__restrict s, int c, size_t n) +{ + int ic = (c << 24) + ((char) c << 16) + ((char) c << 8) + (char) c; + __int_memset (s, ic, n); +} + +void +__wrd_memset (void *__restrict s, int c, size_t n) +{ + int sc = ((c << 8) + (char) c); + __short_int_memset (s, sc, n); +} + +void +__byt_memset (void *__restrict s, int c, size_t n) +{ + __byte_memset (s, c, n); +} diff --git a/libgcc/config/visium/memset.h b/libgcc/config/visium/memset.h new file mode 100644 index 00000000000..92eb1a3b859 --- /dev/null +++ b/libgcc/config/visium/memset.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2012-2015 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* Specialized variants of memset called directly from compiled code. */ + +extern void +__long_int_memset (void *__restrict s, int c, size_t n); + +extern void +__wrd_memset (void *__restrict s, int c, size_t n); + +extern void +__byt_memset (void *__restrict s, int c, size_t n); diff --git a/libgcc/config/visium/moddi3.c b/libgcc/config/visium/moddi3.c new file mode 100644 index 00000000000..bf7a63f3a3a --- /dev/null +++ b/libgcc/config/visium/moddi3.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_moddi3 +#include "lib2funcs.c" diff --git a/libgcc/config/visium/set_trampoline_parity.c b/libgcc/config/visium/set_trampoline_parity.c new file mode 100644 index 00000000000..134cf2b7c87 --- /dev/null +++ b/libgcc/config/visium/set_trampoline_parity.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_set_trampoline_parity +#include "lib2funcs.c" diff --git a/libgcc/config/visium/t-visium b/libgcc/config/visium/t-visium new file mode 100644 index 00000000000..ea5976291c1 --- /dev/null +++ b/libgcc/config/visium/t-visium @@ -0,0 +1,29 @@ +# Copyright (C) 2003-2015 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +LIB2FUNCS_EXCLUDE += _divdi3 _moddi3 _udivdi3 _umoddi3 _udivmoddi4 + +LIB2ADD += \ + $(srcdir)/config/visium/divdi3.c \ + $(srcdir)/config/visium/moddi3.c \ + $(srcdir)/config/visium/udivdi3.c \ + $(srcdir)/config/visium/umoddi3.c \ + $(srcdir)/config/visium/udivmoddi4.c \ + $(srcdir)/config/visium/memcpy.c \ + $(srcdir)/config/visium/memset.c \ + $(srcdir)/config/visium/set_trampoline_parity.c diff --git a/libgcc/config/visium/udivdi3.c b/libgcc/config/visium/udivdi3.c new file mode 100644 index 00000000000..c595251971b --- /dev/null +++ b/libgcc/config/visium/udivdi3.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_udivdi3 +#include "lib2funcs.c" diff --git a/libgcc/config/visium/udivmoddi4.c b/libgcc/config/visium/udivmoddi4.c new file mode 100644 index 00000000000..bd45a5c7c6f --- /dev/null +++ b/libgcc/config/visium/udivmoddi4.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_udivmoddi4 +#include "lib2funcs.c" diff --git a/libgcc/config/visium/umoddi3.c b/libgcc/config/visium/umoddi3.c new file mode 100644 index 00000000000..cd2b23e0d05 --- /dev/null +++ b/libgcc/config/visium/umoddi3.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2014-2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#define L_umoddi3 +#include "lib2funcs.c" |