[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/libc/string/bfin/Makefile b/ap/build/uClibc/libc/string/bfin/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/bfin/memchr.S b/ap/build/uClibc/libc/string/bfin/memchr.S
new file mode 100644
index 0000000..26d419f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memchr.S
@@ -0,0 +1,55 @@
+/* memchr.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memchr(const void *s, int c, size_t n);
+ * R0 = address (s)
+ * R1 = sought byte (c)
+ * R2 = count (n)
+ *
+ * Returns pointer to located character.
+ */
+
+.text
+
+.align 2
+
+.weak _memchr
+ENTRY(_memchr)
+ P0 = R0; /* P0 = address */
+ P2 = R2; /* P2 = count */
+ R1 = R1.B(Z);
+ CC = R2 == 0;
+ IF CC JUMP .Lfailed;
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+
+.Lbyte_loop_s:
+ R3 = B[P0++](Z);
+ CC = R3 == R1;
+ IF CC JUMP .Lfound;
+.Lbyte_loop_e:
+ NOP;
+
+.Lfailed:
+ R0=0;
+ RTS;
+
+.Lfound:
+ R0 = P0;
+ R0 += -1;
+ RTS;
+
+.size _memchr,.-_memchr
+
+libc_hidden_def (memchr)
diff --git a/ap/build/uClibc/libc/string/bfin/memcmp.S b/ap/build/uClibc/libc/string/bfin/memcmp.S
new file mode 100644
index 0000000..7cc76ad
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memcmp.S
@@ -0,0 +1,104 @@
+/* memcmp.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* int memcmp(const void *s1, const void *s2, size_t n);
+ * R0 = First Address (s1)
+ * R1 = Second Address (s2)
+ * R2 = count (n)
+ *
+ * Favours word aligned data.
+ */
+
+.text
+
+.align 2
+
+.weak _memcmp
+ENTRY(_memcmp)
+ I1 = P3;
+ P0 = R0; /* P0 = s1 address */
+ P3 = R1; /* P3 = s2 Address */
+ P2 = R2 ; /* P2 = count */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ I0 = R1; /* s2 */
+ R1 = R1 | R0; /* OR addresses together */
+ R1 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes ; /* Jump if addrs not aligned. */
+
+ P1 = P2 >> 2; /* count = n/4 */
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s:
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ MNOP || R0 = [P0++] || R1 = [I0++];
+#else
+ R0 = [P0++];
+ R1 = [I0++];
+#endif
+ CC = R0 == R1;
+ IF !CC JUMP .Lquad_different;
+.Lquad_loop_e:
+ NOP;
+
+ P3 = I0; /* s2 */
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely*/
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s:
+ R1 = B[P3++](Z); /* *s2 */
+ R0 = B[P0++](Z); /* *s1 */
+ CC = R0 == R1;
+ IF !CC JUMP .Ldifferent;
+.Lbyte_loop_e:
+ NOP;
+
+.Ldifferent:
+ R0 = R0 - R1;
+ P3 = I1;
+ RTS;
+
+.Lquad_different:
+ /* We've read two quads which don't match.
+ * Can't just compare them, because we're
+ * a little-endian machine, so the MSBs of
+ * the regs occur at later addresses in the
+ * string.
+ * Arrange to re-read those two quads again,
+ * byte-by-byte.
+ */
+ P0 += -4; /* back up to the start of the */
+ P3 = I0; /* quads, and increase the*/
+ P2 += 4; /* remainder count*/
+ P3 += -4;
+ JUMP .Lbytes;
+
+.Lfinished:
+ R0 = 0;
+ P3 = I1;
+ RTS;
+
+.size _memcmp,.-_memcmp
+
+libc_hidden_def (memcmp)
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias (memcmp,bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/bfin/memcpy.S b/ap/build/uClibc/libc/string/bfin/memcpy.S
new file mode 100644
index 0000000..bdd7606
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memcpy.S
@@ -0,0 +1,77 @@
+/* memcpy.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memcpy(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count
+ *
+ * Note: Favours word alignment
+ */
+
+.text
+
+.align 2
+
+.weak _memcpy
+ENTRY(_memcpy)
+ [--SP] = P3;
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ I0 = R1;
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned. */
+ P1 = P2 >> 2; /* count = n/4 */
+ P1 += -1;
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+ R1 = [I0++];
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+#else
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
+#endif
+ [P0++] = R1;
+
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 for remaining copy */
+ IF !CC JUMP .Lbytes;
+ P3 = [SP++];
+ RTS;
+
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* very unlikely */
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s: R1 = B[P3++](Z);
+.Lbyte_loop_e: B[P0++] = R1;
+
+.Lfinished:
+ P3 = [SP++];
+
+ RTS;
+
+.size _memcpy,.-_memcpy
+
+libc_hidden_def (memcpy)
diff --git a/ap/build/uClibc/libc/string/bfin/memmove.S b/ap/build/uClibc/libc/string/bfin/memmove.S
new file mode 100644
index 0000000..73e3638
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memmove.S
@@ -0,0 +1,100 @@
+/* memmove.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memmove(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count (n)
+ *
+ * Note: Data may overlap
+ */
+
+.text
+
+.align 2
+
+.weak _memmove
+ENTRY(_memmove)
+ I1 = P3;
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely */
+
+ CC = R1 < R0 (IU); /* From < To */
+ IF !CC JUMP .Lno_overlap;
+ R3 = R1 + R2;
+ CC = R0 <= R3 (IU); /* (From+len) >= To */
+ IF CC JUMP .Loverlap;
+.Lno_overlap:
+ R3 = 11;
+ CC = R2 <= R3;
+ IF CC JUMP .Lbytes;
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero.*/
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned.*/
+
+ I0 = P3;
+ P1 = P2 >> 2; /* count = n/4 */
+ P1 += -1;
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+ R1 = [I0++];
+
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+#else
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
+#endif
+ [P0++] = R1;
+
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 to updated ptr. */
+ IF !CC JUMP .Lbytes;
+ P3 = I1;
+ RTS;
+
+.Lbytes: LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
+.Lbyte2_s: R1 = B[P3++](Z);
+.Lbyte2_e: B[P0++] = R1;
+
+.Lfinished: P3 = I1;
+ RTS;
+
+.Loverlap:
+ P2 += -1;
+ P0 = P0 + P2;
+ P3 = P3 + P2;
+ R1 = B[P3--] (Z);
+ CC = P2 == 0;
+ IF CC JUMP .Lno_loop;
+#if defined(__WORKAROUND_SPECULATIVE_LOADS)
+ NOP;
+ NOP;
+#endif
+ LSETUP (.Lol_s, .Lol_e) LC0 = P2;
+.Lol_s: B[P0--] = R1;
+.Lol_e: R1 = B[P3--] (Z);
+.Lno_loop: B[P0] = R1;
+ P3 = I1;
+ RTS;
+
+.size _memmove,.-_memmove
+
+libc_hidden_def (memmove)
diff --git a/ap/build/uClibc/libc/string/bfin/memset.S b/ap/build/uClibc/libc/string/bfin/memset.S
new file mode 100644
index 0000000..64012f7
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memset.S
@@ -0,0 +1,90 @@
+/* memset.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memset(void *s, int c, size_t n);
+ * R0 = address (s) (leave unchanged to form result)
+ * R1 = filler byte (c)
+ * R2 = count (n)
+ *
+ * Note: Favours word aligned data.
+ */
+
+.text
+
+.align 2
+
+.weak _memset
+ENTRY(_memset)
+ P0 = R0 ; /* P0 = address */
+ P2 = R2 ; /* P2 = count */
+ R3 = R0 + R2; /* end */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ R1 = R1.B (Z); /* R1 = fill char */
+ R2 = 3;
+ R2 = R0 & R2; /* addr bottom two bits */
+ CC = R2 == 0; /* AZ set if zero. */
+ IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
+
+.Laligned:
+ P1 = P2 >> 2; /* count = n/4 */
+ R2 = R1 << 8; /* create quad filler */
+ R2.L = R2.L + R1.L(NS);
+ R2.H = R2.L + R1.H(NS);
+ P2 = R3;
+
+ LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
+.Lquad_loop:
+ [P0++] = R2;
+
+ CC = P0 == P2;
+ IF !CC JUMP .Lbytes_left;
+ RTS;
+
+.Lbytes_left:
+ R2 = R3; /* end point */
+ R3 = P0; /* current position */
+ R2 = R2 - R3; /* bytes left */
+ P2 = R2;
+
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* Unusual */
+
+.Lbytes:
+ LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
+.Lbyte_loop:
+ B[P0++] = R1;
+
+.Lfinished:
+ RTS;
+
+.Lforce_align:
+ CC = BITTST (R0, 0); /* odd byte */
+ R0 = 4;
+ R0 = R0 - R2;
+ P1 = R0;
+ R0 = P0; /* Recover return address */
+ IF !CC JUMP .Lskip1;
+ B[P0++] = R1;
+.Lskip1:
+ CC = R2 <= 2; /* 2 bytes */
+ P2 -= P1; /* reduce count */
+ IF !CC JUMP .Laligned;
+ B[P0++] = R1;
+ B[P0++] = R1;
+ JUMP .Laligned;
+
+.size _memset,.-_memset
+
+libc_hidden_def (memset)
diff --git a/ap/build/uClibc/libc/string/bfin/strcmp.S b/ap/build/uClibc/libc/string/bfin/strcmp.S
new file mode 100644
index 0000000..ef23aa9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/strcmp.S
@@ -0,0 +1,122 @@
+/* strcmp.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* Fast strcmp() for Blackfin.
+ * When both strings are aligned, this processes four characters at
+ * a time. Uses a hw loop with "very big" count to loop "forever",
+ * until difference or a terminating zero is found.
+ * Once the end-case word has been identified, breaks out of the
+ * loop to check more carefully (same as the unaligned case).
+ */
+
+.text
+
+.align 2
+
+.weak _strcmp
+ENTRY(_strcmp)
+ [--sp] = (R7:4);
+ p1 = r0;
+ p2 = r1;
+
+ p0 = -1; /* (need for loop counter init) */
+
+ /* check if byte aligned */
+ r0 = r0 | r1; /* check both pointers at same time */
+ r0 <<= 30; /* dump all but last 2 bits */
+ cc = az; /* are they zero? */
+ if !cc jump .Lunaligned; /* no; use unaligned code. */
+ /* fall-thru for aligned case.. */
+
+ /* note that r0 is zero from the previous... */
+ /* p0 set to -1 */
+
+ LSETUP (.Lbeginloop, .Lendloop) lc0=p0;
+ /* pick up first words */
+ r1 = [p1++];
+ r2 = [p2++];
+ /* make up mask: 0FF0FF */
+ r7 = 0xFF;
+ r7.h = 0xFF;
+ /* loop : 9 cycles to check 4 characters */
+ cc = r1 == r2;
+.Lbeginloop:
+ if !cc jump .Lnotequal4; /* compare failure, exit loop */
+
+ /* starting with 44332211 */
+ /* see if char 3 or char 1 is 0 */
+ r3 = r1 & r7; /* form 00330011 */
+ /* add to zero, and (r2 is free, reload) */
+ r6 = r3 +|+ r0 || r2 = [p2++] || nop;
+ cc = az; /* true if either is zero */
+ r3 = r1 ^ r3; /* form 44002200 (4321^0301 => 4020) */
+ /* (trick, saves having another mask) */
+ /* add to zero, and (r1 is free, reload) */
+ r6 = r3 +|+ r0 || r1 = [p1++] || nop;
+ cc |= az; /* true if either is zero */
+ if cc jump .Lzero4; /* leave if a zero somewhere */
+.Lendloop:
+ cc = r1 == r2;
+
+ /* loop exits */
+.Lnotequal4: /* compare failure on 4-char compare */
+ /* address pointers are one word ahead; */
+ /* faster to use zero4 exit code */
+ p1 += 4;
+ p2 += 4;
+
+.Lzero4: /* one of the bytes in word 1 is zero */
+ /* but we've already fetched the next word; so */
+ /* backup two to look at failing word again */
+ p1 += -8;
+ p2 += -8;
+
+
+
+ /* here when pointers are unaligned: checks one */
+ /* character at a time. Also use at the end of */
+ /* the word-check algorithm to figure out what happened */
+.Lunaligned:
+ /* R0 is non-zero from before. */
+ /* p0 set to -1 */
+
+ r0 = 0 (Z);
+ r1 = B[p1++] (Z);
+ r2 = B[p2++] (Z);
+ LSETUP (.Lbeginloop1, .Lendloop1) lc0=p0;
+
+.Lbeginloop1:
+ cc = r1; /* first char must be non-zero */
+ /* chars must be the same */
+ r3 = r2 - r1 (NS) || r1 = B[p1++] (Z) || nop;
+ cc &= az;
+ r3 = r0 - r2; /* second char must be non-zero */
+ cc &= an;
+ if !cc jump .Lexitloop1;
+.Lendloop1:
+ r2 = B[p2++] (Z);
+
+.Lexitloop1: /* here means we found a zero or a difference. */
+ /* we have r2(N), p2(N), r1(N+1), p1(N+2) */
+ r1=B[p1+ -2] (Z);
+ r0 = r1 - r2;
+ (r7:4) = [sp++];
+ rts;
+.size _strcmp,.-_strcmp
+
+libc_hidden_def (strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+weak_alias (strcmp,strcoll)
+libc_hidden_def (strcoll)
+#endif