* 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
+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):
#ifdef L_udivsi3
FUNC_START udivsi3
+ FUNC_ALIAS aeabi_uidiv udivsi3
#ifdef __thumb__
#ifdef L_divsi3
FUNC_START divsi3
+ FUNC_ALIAS aeabi_idiv divsi3
#ifdef __thumb__
cmp divisor, #0
__aeabi_fsub
__aeabi_i2d
__aeabi_i2f
+ __aeabi_idiv
__aeabi_idiv0
__aeabi_idivmod
__aeabi_l2d
__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
_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 \
--- /dev/null
+/* 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;
+}
+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
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>
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) \
{ \
#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);
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);
}