diff options
author | Richard Sandiford <richard@codesourcery.com> | 2005-08-10 13:06:52 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2005-08-10 13:06:52 +0000 |
commit | 9bd0510849773836fce158f056b7d1f81d01f961 (patch) | |
tree | 3a9f557e2583324e47fe3e9182f54c00f6e3aaa7 | |
parent | defb77dcaa265e418d04840b4d0dc69288690b26 (diff) | |
download | gcc-9bd0510849773836fce158f056b7d1f81d01f961.zip gcc-9bd0510849773836fce158f056b7d1f81d01f961.tar.gz gcc-9bd0510849773836fce158f056b7d1f81d01f961.tar.bz2 |
lib1funcs.asm (__aeabi_uidiv, [...]): New aliases.
* 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
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/arm/lib1funcs.asm | 2 | ||||
-rw-r--r-- | gcc/config/arm/libgcc-bpabi.ver | 6 | ||||
-rw-r--r-- | gcc/config/arm/t-bpabi | 3 | ||||
-rw-r--r-- | gcc/config/arm/unaligned-funcs.c | 62 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/arm-eabi1.c | 40 |
7 files changed, 123 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1289a21..8092a46 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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): diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm index ebf31eb..3c6c1fe 100644 --- a/gcc/config/arm/lib1funcs.asm +++ b/gcc/config/arm/lib1funcs.asm @@ -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 diff --git a/gcc/config/arm/libgcc-bpabi.ver b/gcc/config/arm/libgcc-bpabi.ver index 35966bb..2f259eb 100644 --- a/gcc/config/arm/libgcc-bpabi.ver +++ b/gcc/config/arm/libgcc-bpabi.ver @@ -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 diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi index 74c0ae1..3498107 100644 --- a/gcc/config/arm/t-bpabi +++ b/gcc/config/arm/t-bpabi @@ -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 index 0000000..44aef8c --- /dev/null +++ b/gcc/config/arm/unaligned-funcs.c @@ -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; +} diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 774b0b8..effde2e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gcc.dg/arm-eabi1.c b/gcc/testsuite/gcc.dg/arm-eabi1.c index 0df295a..f80f980 100644 --- a/gcc/testsuite/gcc.dg/arm-eabi1.c +++ b/gcc/testsuite/gcc.dg/arm-eabi1.c @@ -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); } |