]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lib1funcs.asm (__aeabi_uidiv, [...]): New aliases.
authorRichard Sandiford <richard@codesourcery.com>
Wed, 10 Aug 2005 13:06:52 +0000 (13:06 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 10 Aug 2005 13:06:52 +0000 (13:06 +0000)
* config/arm/lib1funcs.asm (__aeabi_uidiv, __aeabi_idiv): New aliases.
* config/arm/libgcc-bpabi.ver (GCC_3.5): Add __aeabi_idiv,
__aeabi_uidiv, __aeabi_uread4, __aeabi_uread8, __aeabi_uwrite4
and __aeabi_uwrite8.
* config/arm/unaligned-funcs.c: New file.
* config/arm/t-bpabi (LIB2FUNCS_EXTRA): Add unaligned-funcs.c.

From-SVN: r102947

gcc/ChangeLog
gcc/config/arm/lib1funcs.asm
gcc/config/arm/libgcc-bpabi.ver
gcc/config/arm/t-bpabi
gcc/config/arm/unaligned-funcs.c [new file with mode: 0644]
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/arm-eabi1.c

index 1289a219a15c3a6a2f3dbadcebd69a6ea7759a81..8092a46e2bb44873b3523e0b7f8d85887233d6f2 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-10  Richard Sandiford  <richard@codesourcery.com>
+
+       * config/arm/lib1funcs.asm (__aeabi_uidiv, __aeabi_idiv): New aliases.
+       * config/arm/libgcc-bpabi.ver (GCC_3.5): Add __aeabi_idiv,
+       __aeabi_uidiv, __aeabi_uread4, __aeabi_uread8, __aeabi_uwrite4
+       and __aeabi_uwrite8.
+       * config/arm/unaligned-funcs.c: New file.
+       * config/arm/t-bpabi (LIB2FUNCS_EXTRA): Add unaligned-funcs.c.
+
 2005-08-09  Paolo Bonzini  <bonzini@gnu.org>
 
        * bb-reorder.c (pass_duplicate_computed_gotos, pass_partition_blocks):
index ebf31eb8cc5c8de9d3d53734dbcc7db3b93fce19..3c6c1fe047f7f5eb9ddb9eaa2b348b372ac1cb28 100644 (file)
@@ -702,6 +702,7 @@ LSYM(Lgot_result):
 #ifdef L_udivsi3
 
        FUNC_START udivsi3
+       FUNC_ALIAS aeabi_uidiv udivsi3
 
 #ifdef __thumb__
 
@@ -812,6 +813,7 @@ LSYM(Lover10):
 #ifdef L_divsi3
 
        FUNC_START divsi3       
+       FUNC_ALIAS aeabi_idiv divsi3
 
 #ifdef __thumb__
        cmp     divisor, #0
index 35966bbfc72876234941e569d7e3bb86d8cf7bbe..2f259eb646e0b271c1eaffcaaadaed802520c5c9 100644 (file)
@@ -42,6 +42,7 @@ GCC_3.5 {
   __aeabi_fsub
   __aeabi_i2d
   __aeabi_i2f
+  __aeabi_idiv
   __aeabi_idiv0
   __aeabi_idivmod
   __aeabi_l2d
@@ -55,11 +56,16 @@ GCC_3.5 {
   __aeabi_lmul
   __aeabi_ui2d
   __aeabi_ui2f
+  __aeabi_uidiv
   __aeabi_uidivmod
   __aeabi_uldivmod
   __aeabi_ulcmp
   __aeabi_ul2d
   __aeabi_ul2f
+  __aeabi_uread4
+  __aeabi_uread8
+  __aeabi_uwrite4
+  __aeabi_uwrite8
 
   # Exception-Handling
   # \S 7.5
index 74c0ae138a3ae618f803fd2a01db63a68e4f2642..34981078e0eadbccc2e11cbcffb45e43a412f69d 100644 (file)
@@ -3,7 +3,8 @@ LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod \
   _unwind
 
 # Add the BPABI C functions.
-LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c
+LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \
+                 $(srcdir)/config/arm/unaligned-funcs.c
 
 UNWIND_H = $(srcdir)/config/arm/unwind-arm.h
 LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
diff --git a/gcc/config/arm/unaligned-funcs.c b/gcc/config/arm/unaligned-funcs.c
new file mode 100644 (file)
index 0000000..44aef8c
--- /dev/null
@@ -0,0 +1,62 @@
+/* EABI unaligned read/write functions.
+
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   Contributed by CodeSourcery, LLC.
+
+   This file 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 2, or (at your option) any
+   later version.
+
+   In addition to the permissions in the GNU General Public License, the
+   Free Software Foundation gives you unlimited permission to link the
+   compiled version of this file into combinations with other programs,
+   and to distribute those combinations without any restriction coming
+   from the use of this file.  (The General Public License restrictions
+   do apply in other respects; for example, they cover modification of
+   the file, and distribution when not linked into a combine
+   executable.)
+
+   This file 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 this program; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+int __aeabi_uread4 (void *);
+int __aeabi_uwrite4 (int, void *);
+long long __aeabi_uread8 (void *);
+long long __aeabi_uwrite8 (long long, void *);
+
+struct __attribute__((packed)) u4 { int data; };
+struct __attribute__((packed)) u8 { long long data; };
+
+int
+__aeabi_uread4 (void *ptr)
+{
+  return ((struct u4 *) ptr)->data;
+}
+
+int
+__aeabi_uwrite4 (int data, void *ptr)
+{
+  ((struct u4 *) ptr)->data = data;
+  return data;
+}
+
+long long
+__aeabi_uread8 (void *ptr)
+{
+  return ((struct u8 *) ptr)->data;
+}
+
+long long
+__aeabi_uwrite8 (long long data, void *ptr)
+{
+  ((struct u8 *) ptr)->data = data;
+  return data;
+}
index 774b0b82679cc99893c3a56f12f299d4f672f865..effde2ea49ef4d45ad4db2a67f338d8d435f76ff 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-10  Richard Sandiford  <richard@codesourcery.com>
+
+       * gcc.dg/arm-eabi1.c: Test aeabi_idiv, __aeabi_uidiv, __aeabi_uread4,
+       __aeabi_uread8, __aeabi_uwrite4 and __aeabi_uwrite8.
+
 2005-08-10  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/20646
index 0df295aa72688be6f672693113b0641ded72e34a..f80f98085d311fe000fa9eb91dcade7e3c681c19 100644 (file)
@@ -23,9 +23,8 @@
    require the use of inline assembly to test.  It would be good to
    add such tests, but they have not yet been implemented.  
 
-   There are also no tests for the "division by zero", "unaligned
-   memory access", "memory copying, clearing, and setting"
-   functions.  */
+   There are also no tests for the "division by zero", "memory copying,
+   clearing, and setting" functions.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -74,6 +73,12 @@ extern long long __aeabi_llsr (long long, int);
 extern long long __aeabi_lasr (long long, int);
 extern int __aeabi_lcmp (long long, long long);
 extern int __aeabi_ulcmp (unsigned long long, unsigned long long);
+extern int __aeabi_idiv (int, int);
+extern unsigned int __aeabi_uidiv (unsigned int, unsigned int);
+extern int __eabi_uread4 (void *);
+extern int __eabi_uwrite4 (int, void *);
+extern long long __eabi_uread8 (void *);
+extern long long __eabi_uwrite8 (long long, void *);
 
 #define eq(a, b, type, abs, epsilon, format)                   \
   {                                                            \
@@ -99,6 +104,9 @@ extern int __aeabi_ulcmp (unsigned long long, unsigned long long);
 #define deq(a, b) eq (a, b, double, fabs, depsilon, "%g")
 
 int main () {
+  unsigned char bytes[256];
+  int i;
+
   /* Table 2.  Double-precision floating-point arithmetic.  */
   deq (__aeabi_dadd (dzero, done), done);
   deq (__aeabi_dadd (done, done), dtwo);
@@ -232,4 +240,30 @@ int main () {
   ieq (__aeabi_ulcmp (0LL, 1LL), -1);
   ieq (__aeabi_ulcmp (0LL, 0LL), 0);
   ieq (__aeabi_ulcmp (1LL, 0LL), 1);
+
+  ieq (__aeabi_idiv (-550, 11), -50);
+  ueq (__aeabi_uidiv (4000000000U, 1000000U), 4000U);
+
+  for (i = 0; i < 256; i++)
+    bytes[i] = i;
+
+#ifdef __ARMEB__
+  ieq (__aeabi_uread4 (bytes + 1), 0x01020304U);
+  leq (__aeabi_uread8 (bytes + 3), 0x030405060708090aLL);
+  ieq (__aeabi_uwrite4 (0x66778899U, bytes + 5), 0x66778899U);
+  leq (__aeabi_uwrite8 (0x2030405060708090LL, bytes + 15),
+       0x2030405060708090LL);
+#else
+  ieq (__aeabi_uread4 (bytes + 1), 0x04030201U);
+  leq (__aeabi_uread8 (bytes + 3), 0x0a09080706050403LL);
+  ieq (__aeabi_uwrite4 (0x99887766U, bytes + 5), 0x99887766U);
+  leq (__aeabi_uwrite8 (0x9080706050403020LL, bytes + 15),
+       0x9080706050403020LL);
+#endif
+
+  for (i = 0; i < 4; i++)
+    ieq (bytes[5 + i], (6 + i) * 0x11);
+
+  for (i = 0; i < 8; i++)
+    ieq (bytes[15 + i], (2 + i) * 0x10);
 }