diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-08-11 02:50:14 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-08-11 02:50:14 +0000 |
commit | b3f8d95d356ae617eaa76aa21ebfa0649f927c13 (patch) | |
tree | 8ecb27f99fc899aec528b0cc2ea297f10080750c /gcc/testsuite/gcc.dg/arm-eabi1.c | |
parent | fba73eb1cb3e624b60cb9974d53c004c2562486b (diff) | |
download | gcc-b3f8d95d356ae617eaa76aa21ebfa0649f927c13.zip gcc-b3f8d95d356ae617eaa76aa21ebfa0649f927c13.tar.gz gcc-b3f8d95d356ae617eaa76aa21ebfa0649f927c13.tar.bz2 |
configure.in (arm*-*-eabi*): New target.
* configure.in (arm*-*-eabi*): New target.
* configure: Regenerate.
* configure.ac (arm*-*-eabi*): New target.
(arm*-*-symbianelf*): Likewise.
* configure: Regenerated.
* config.gcc (arm*-*-eabi*): New target.
* defaults.h (TARGET_LIBGCC_FUNCS): New macro.
(TARGET_LIB_INT_CMP_BIASED): Likewise.
* expmed.c (expand_divmod): Try a two-valued divmod function as a
last resort.
* gthr.h: Remove bogus tokens at end of #pragma.
* optabs.c (expand_twoval_binop_libfunc): New function.
(prepare_cmp_insn): Handle the !TARGET_LIB_INT_CMP_BIASED case.
(prepare_float_lib_cmp): Try reversing the condition.
(debug_optab_libfuncs): New function.
* optabs.h (expand_twoval_binop_libfunc): Declare.
* config/arm/arm.c (arm_init_libfuncs): New function.
(arm_compute_initial_eliminatino_offset): Return HOST_WIDE_INT.
(TARGET_INIT_LIBFUNCS): Define it.
* config/arm/arm.h (TARGET_BPABI): New macro.
* config/arm/arm-protos.h
(arm_compute_initial_elimination_offset): Return HOST_WIDE_INT.
* config/arm/bpabi.S: New file.
* config/arm/bpabi.c: Likewise.
* config/arm/bpabi.h: Likewise.
* config/arm/ieee754-df.S (__aeabi_dneg): New function or alias.
(__aeabi_drsub): Likewise.
(__aeabi_dsub): Likewise.
(__aeabi_dadd): Likewise.
(__aeabi_ui2d): Likewise.
(__aeabi_i2d): Likewise.
(__aeabi_f2d): Likewise.
(__aeabi_dmul): Likewise.
(__aeabi_ddiv): Likewise.
(__aeabi_cdrcmple): Likewise.
(__aeabi_cdcmpeq): Likewise.
(__aeabi_cdcmple): Likewise.
(__aeabi_dcmpeq): Likewise.
(__aeabi_dcmplt): Likewise.
(__aeabi_dcmple): Likewise.
(__aeabi_dcmpge): Likewise.
(__aeabi_dcmpgt): Likewise.
(__aeabi_dcmpun): Likewise.
(__aeabi_d2iz): Likewise.
(__aeabi_d2uiz): Likewise.
(__aeabi_d2f): Likewise.
* config/arm/ieee754-sf.S (__aeabi_fneg): New function or alias.
(__aeabi_frsub): Likewise.
(__aeabi_fsub): Likewise.
(__aeabi_fadd): Likewise.
(__aeabi_ui2f): Likewise.
(__aeabi_i2f): Likewise.
(__aeabi_fmul): Likewise.
(__aeabi_fdiv): Likewise.
(__aeabi_cfrcmple): Likewise.
(__aeabi_cfcmpeq): Likewise.
(__aeabi_cfcmple): Likewise.
(__aeabi_fcmpeq): Likewise.
(__aeabi_fcmplt): Likewise.
(__aeabi_fcmple): Likewise.
(__aeabi_fcmpge): Likewise.
(__aeabi_fcmpgt): Likewise.
(__aeabi_fcmpun): Likewise.
(__aeabi_f2iz): Likewise.
(__aeabi_f2uiz): Likewise.
* config/arm/lib1funcs.asm (ARM_CALL): New macro.
(__aeabi_uidivmod): New function or alias.
(__aeabi_idivmod): Likewise.
(__aeabi_idiv0): Likewise.
(__aeabi_ldiv0): Likewise.
(__aeabi_llsr): Likewise.
(__aeabi_lasr): Likewise.
(__aeabi_llsl): Likewise.
(bpabi.S): Include it.
* config/arm/libgcc-bpabi.ver: New file.
* config/arm/symbian.h (ARM_DEFAULT_ABI): Remove.
(LINK_SPEC): Remove.
* config/arm/t-arm-elf (LIB1ASMFUNCS): Add __aeabi_lcmp and
__aeabi_ulcmp.
* config/arm/t-bpabi: New file.
* doc/tm.texi (TARGET_LIBGCC_FUNCS): New entry.
(TARGET_LIB_INT_CMP_BIASED): Likewise.
* gcc.dg/testsuite/gcc.dg/arm-eabi1.c: New test.
* gcc.dg/dll-2.c: Fix dg-require syntax.
* gcc.misc-tests/arm-isr.c (abort): Declare.
(exit): Likewise.
From-SVN: r85788
Diffstat (limited to 'gcc/testsuite/gcc.dg/arm-eabi1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/arm-eabi1.c | 235 |
1 files changed, 235 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/arm-eabi1.c b/gcc/testsuite/gcc.dg/arm-eabi1.c new file mode 100644 index 0000000..0df295a --- /dev/null +++ b/gcc/testsuite/gcc.dg/arm-eabi1.c @@ -0,0 +1,235 @@ +/* { dg-do run { target arm*-*-symbianelf* arm*-*-eabi* } } */ +/* { dg-options "" } */ + +/* This file tests most of the non-C++ run-time helper functions + described in Section 4 of the "Run-Time ABI for the ARM + Architecture". These are basic tests; they do not try to validate + all of the corner cases in these routines. + + The functions not tested here are: + + __aeabi_cdcmpeq + __aeabi_cdcmple + __aeabi_cdrcmple + __aeabi_cfcmpeq + __aeabi_cfcmple + __aeabi_cfrcmple + __aeabi_ldivmod + __aeabi_uldivmod + __aeabi_idivmod + __aeabi_uidivmod + + These functions have non-standard calling conventions that would + 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. */ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +#define decl_float(code, type) \ + extern type __aeabi_ ## code ## add (type, type); \ + extern type __aeabi_ ## code ## div (type, type); \ + extern type __aeabi_ ## code ## mul (type, type); \ + extern type __aeabi_ ## code ## neg (type); \ + extern type __aeabi_ ## code ## rsub (type, type); \ + extern type __aeabi_ ## code ## sub (type, type); \ + extern int __aeabi_ ## code ## cmpeq (type, type); \ + extern int __aeabi_ ## code ## cmplt (type, type); \ + extern int __aeabi_ ## code ## cmple (type, type); \ + extern int __aeabi_ ## code ## cmpge (type, type); \ + extern int __aeabi_ ## code ## cmpgt (type, type); \ + extern int __aeabi_ ## code ## cmpun (type, type); \ + extern int __aeabi_ ## code ## 2iz (type); \ + extern unsigned int __aeabi_ ## code ## 2uiz (type); \ + extern long long __aeabi_ ## code ## 2lz (type); \ + extern unsigned long long __aeabi_ ## code ## 2ulz (type); \ + extern type __aeabi_i2 ## code (int); \ + extern type __aeabi_ui2 ## code (int); \ + extern type __aeabi_l2 ## code (long long); \ + extern type __aeabi_ul2 ## code (unsigned long long); \ + \ + type code ## zero = 0.0; \ + type code ## one = 1.0; \ + type code ## two = 2.0; \ + type code ## four = 4.0; \ + type code ## minus_one = -1.0; \ + type code ## minus_two = -2.0; \ + type code ## minus_four = -4.0; \ + type code ## epsilon = 1E-32; \ + type code ## NaN = 0.0 / 0.0; + +decl_float (d, double) +decl_float (f, float) + +extern float __aeabi_d2f (double); +extern double __aeabi_f2d (float); +extern long long __aeabi_lmul (long long, long long); +extern long long __aeabi_llsl (long long, int); +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); + +#define eq(a, b, type, abs, epsilon, format) \ + { \ + type a1; \ + type b1; \ + \ + fprintf (stderr, "%d: Test %s == %s\n", __LINE__, #a, #b); \ + a1 = a; \ + b1 = b; \ + if (abs (a1 - b1) > epsilon) \ + { \ + fprintf (stderr, "%d: " format " != " format "\n", \ + __LINE__, a1, b1); \ + abort (); \ + } \ + } + +#define ieq(a, b) eq (a, b, int, abs, 0, "%d") +#define ueq(a, b) eq (a, b, unsigned int, abs, 0, "%u") +#define leq(a, b) eq (a, b, long long, abs, 0, "%lld") +#define uleq(a, b) eq (a, b, unsigned long long, abs, 0, "%llu") +#define feq(a, b) eq (a, b, float, fabs, fepsilon, "%f") +#define deq(a, b) eq (a, b, double, fabs, depsilon, "%g") + +int main () { + /* Table 2. Double-precision floating-point arithmetic. */ + deq (__aeabi_dadd (dzero, done), done); + deq (__aeabi_dadd (done, done), dtwo); + deq (__aeabi_ddiv (dminus_four, dminus_two), dtwo); + deq (__aeabi_ddiv (dminus_two, dtwo), dminus_one); + deq (__aeabi_dmul (dtwo, dtwo), dfour); + deq (__aeabi_dmul (dminus_one, dminus_two), dtwo); + deq (__aeabi_dneg (dminus_one), done); + deq (__aeabi_dneg (dfour), dminus_four); + deq (__aeabi_drsub (done, dzero), dminus_one); + deq (__aeabi_drsub (dtwo, dminus_two), dminus_four); + deq (__aeabi_dsub (dzero, done), dminus_one); + deq (__aeabi_dsub (dminus_two, dtwo), dminus_four); + + /* Table 3. Double-precision floating-point comparisons. */ + ieq (__aeabi_dcmpeq (done, done), 1); + ieq (__aeabi_dcmpeq (done, dzero), 0); + ieq (__aeabi_dcmpeq (dNaN, dzero), 0); + ieq (__aeabi_dcmpeq (dNaN, dNaN), 0); + + ieq (__aeabi_dcmplt (dzero, done), 1); + ieq (__aeabi_dcmplt (done, dzero), 0); + ieq (__aeabi_dcmplt (dzero, dzero), 0); + ieq (__aeabi_dcmplt (dzero, dNaN), 0); + ieq (__aeabi_dcmplt (dNaN, dNaN), 0); + + ieq (__aeabi_dcmple (dzero, done), 1); + ieq (__aeabi_dcmple (done, dzero), 0); + ieq (__aeabi_dcmple (dzero, dzero), 1); + ieq (__aeabi_dcmple (dzero, dNaN), 0); + ieq (__aeabi_dcmple (dNaN, dNaN), 0); + + ieq (__aeabi_dcmpge (dzero, done), 0); + ieq (__aeabi_dcmpge (done, dzero), 1); + ieq (__aeabi_dcmpge (dzero, dzero), 1); + ieq (__aeabi_dcmpge (dzero, dNaN), 0); + ieq (__aeabi_dcmpge (dNaN, dNaN), 0); + + ieq (__aeabi_dcmpgt (dzero, done), 0); + ieq (__aeabi_dcmpgt (done, dzero), 1); + ieq (__aeabi_dcmplt (dzero, dzero), 0); + ieq (__aeabi_dcmpgt (dzero, dNaN), 0); + ieq (__aeabi_dcmpgt (dNaN, dNaN), 0); + + ieq (__aeabi_dcmpun (done, done), 0); + ieq (__aeabi_dcmpun (done, dzero), 0); + ieq (__aeabi_dcmpun (dNaN, dzero), 1); + ieq (__aeabi_dcmpun (dNaN, dNaN), 1); + + /* Table 4. Single-precision floating-point arithmetic. */ + feq (__aeabi_fadd (fzero, fone), fone); + feq (__aeabi_fadd (fone, fone), ftwo); + feq (__aeabi_fdiv (fminus_four, fminus_two), ftwo); + feq (__aeabi_fdiv (fminus_two, ftwo), fminus_one); + feq (__aeabi_fmul (ftwo, ftwo), ffour); + feq (__aeabi_fmul (fminus_one, fminus_two), ftwo); + feq (__aeabi_fneg (fminus_one), fone); + feq (__aeabi_fneg (ffour), fminus_four); + feq (__aeabi_frsub (fone, fzero), fminus_one); + feq (__aeabi_frsub (ftwo, fminus_two), fminus_four); + feq (__aeabi_fsub (fzero, fone), fminus_one); + feq (__aeabi_fsub (fminus_two, ftwo), fminus_four); + + /* Table 5. Single-precision floating-point comparisons. */ + ieq (__aeabi_fcmpeq (fone, fone), 1); + ieq (__aeabi_fcmpeq (fone, fzero), 0); + ieq (__aeabi_fcmpeq (fNaN, fzero), 0); + ieq (__aeabi_fcmpeq (fNaN, fNaN), 0); + + ieq (__aeabi_fcmplt (fzero, fone), 1); + ieq (__aeabi_fcmplt (fone, fzero), 0); + ieq (__aeabi_fcmplt (fzero, fzero), 0); + ieq (__aeabi_fcmplt (fzero, fNaN), 0); + ieq (__aeabi_fcmplt (fNaN, fNaN), 0); + + ieq (__aeabi_fcmple (fzero, fone), 1); + ieq (__aeabi_fcmple (fone, fzero), 0); + ieq (__aeabi_fcmple (fzero, fzero), 1); + ieq (__aeabi_fcmple (fzero, fNaN), 0); + ieq (__aeabi_fcmple (fNaN, fNaN), 0); + + ieq (__aeabi_fcmpge (fzero, fone), 0); + ieq (__aeabi_fcmpge (fone, fzero), 1); + ieq (__aeabi_fcmpge (fzero, fzero), 1); + ieq (__aeabi_fcmpge (fzero, fNaN), 0); + ieq (__aeabi_fcmpge (fNaN, fNaN), 0); + + ieq (__aeabi_fcmpgt (fzero, fone), 0); + ieq (__aeabi_fcmpgt (fone, fzero), 1); + ieq (__aeabi_fcmplt (fzero, fzero), 0); + ieq (__aeabi_fcmpgt (fzero, fNaN), 0); + ieq (__aeabi_fcmpgt (fNaN, fNaN), 0); + + ieq (__aeabi_fcmpun (fone, fone), 0); + ieq (__aeabi_fcmpun (fone, fzero), 0); + ieq (__aeabi_fcmpun (fNaN, fzero), 1); + ieq (__aeabi_fcmpun (fNaN, fNaN), 1); + + /* Table 6. Floating-point to integer conversions. */ + ieq (__aeabi_d2iz (dminus_one), -1); + ueq (__aeabi_d2uiz (done), 1); + leq (__aeabi_d2lz (dminus_two), -2LL); + uleq (__aeabi_d2ulz (dfour), 4LL); + ieq (__aeabi_f2iz (fminus_one), -1); + ueq (__aeabi_f2uiz (fone), 1); + leq (__aeabi_f2lz (fminus_two), -2LL); + uleq (__aeabi_f2ulz (ffour), 4LL); + + /* Table 7. Conversions between floating types. */ + feq (__aeabi_d2f (dtwo), ftwo); + deq (__aeabi_f2d (fminus_four), dminus_four); + + /* Table 8. Integer to floating-point conversions. */ + deq (__aeabi_i2d (-1), dminus_one); + deq (__aeabi_ui2d (2), dtwo); + deq (__aeabi_l2d (-1), dminus_one); + deq (__aeabi_ul2d (2ULL), dtwo); + feq (__aeabi_i2f (-1), fminus_one); + feq (__aeabi_ui2f (2), ftwo); + feq (__aeabi_l2f (-1), fminus_one); + feq (__aeabi_ul2f (2ULL), ftwo); + + /* Table 9. Long long functions. */ + leq (__aeabi_lmul (4LL, -1LL), -4LL); + leq (__aeabi_llsl (2LL, 1), 4LL); + leq (__aeabi_llsr (-1LL, 63), 1); + leq (__aeabi_lasr (-1LL, 63), -1); + ieq (__aeabi_lcmp (0LL, 1LL), -1); + ieq (__aeabi_lcmp (0LL, 0LL), 0); + ieq (__aeabi_lcmp (1LL, 0LL), 1); + ieq (__aeabi_ulcmp (0LL, 1LL), -1); + ieq (__aeabi_ulcmp (0LL, 0LL), 0); + ieq (__aeabi_ulcmp (1LL, 0LL), 1); +} |