From: Bin Cheng Date: Tue, 14 Feb 2012 07:42:41 +0000 (+0000) Subject: backport: re PR target/51835 (ARM EABI violation when passing arguments to helper... X-Git-Tag: releases/gcc-4.5.4~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db5c1262c6270de6048a83714ff80822635ec8e3;p=thirdparty%2Fgcc.git backport: re PR target/51835 (ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz) Backport from mainline. 2012-01-30 Bin Cheng PR target/51835 * config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI for __aeabi_d2iz/__aeabi_d2uiz with hard-float. 2011-06-08 Julian Brown * config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI for double-precision helper functions in hard-float mode if only single-precision arithmetic is supported in hardware. From-SVN: r184197 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7705d34ba739..54e4e590d3c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2012-02-14 Bin Cheng + + Backport from mainline. + 2012-01-30 Bin Cheng + + PR target/51835 + * config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI + for __aeabi_d2iz/__aeabi_d2uiz with hard-float. + + 2011-06-08 Julian Brown + + * config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI + for double-precision helper functions in hard-float mode if only + single-precision arithmetic is supported in hardware. + 2012-02-09 Jakub Jelinek Backported from mainline diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 08208b75fc07..8522c283fa2f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3338,6 +3338,10 @@ arm_libcall_uses_aapcs_base (const_rtx libcall) convert_optab_libfunc (sext_optab, SFmode, HFmode)); add_libcall (libcall_htab, convert_optab_libfunc (trunc_optab, HFmode, SFmode)); + add_libcall (libcall_htab, + convert_optab_libfunc (sfix_optab, SImode, DFmode)); + add_libcall (libcall_htab, + convert_optab_libfunc (ufix_optab, SImode, DFmode)); add_libcall (libcall_htab, convert_optab_libfunc (sfix_optab, DImode, DFmode)); add_libcall (libcall_htab, @@ -3346,6 +3350,28 @@ arm_libcall_uses_aapcs_base (const_rtx libcall) convert_optab_libfunc (sfix_optab, DImode, SFmode)); add_libcall (libcall_htab, convert_optab_libfunc (ufix_optab, DImode, SFmode)); + + /* Values from double-precision helper functions are returned in core + registers if the selected core only supports single-precision + arithmetic, even if we are using the hard-float ABI. The same is + true for single-precision helpers, but we will never be using the + hard-float ABI on a CPU which doesn't support single-precision + operations in hardware. */ + add_libcall (libcall_htab, optab_libfunc (add_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (sdiv_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (smul_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (neg_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (sub_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (eq_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (lt_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (le_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (ge_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (gt_optab, DFmode)); + add_libcall (libcall_htab, optab_libfunc (unord_optab, DFmode)); + add_libcall (libcall_htab, convert_optab_libfunc (sext_optab, DFmode, + SFmode)); + add_libcall (libcall_htab, convert_optab_libfunc (trunc_optab, SFmode, + DFmode)); } return libcall && htab_find (libcall_htab, libcall) != NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d4ef9a7626d1..8b1e461c2c6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2012-02-14 Bin Cheng + + Backport from mainline. + 2012-01-30 Bin Cheng + + PR target/51835 + * gcc.target/arm/pr51835.c: New testcase. + 2012-02-09 Jakub Jelinek Backported from mainline diff --git a/gcc/testsuite/gcc.target/arm/pr51835.c b/gcc/testsuite/gcc.target/arm/pr51835.c new file mode 100644 index 000000000000..858b72f8ad81 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr51835.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mfloat-abi=hard -mfpu=fpv4-sp-d16" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +int func1 (double d) +{ + return (int)d; +} +unsigned int func2 (double d) +{ + return (unsigned int)d; +} + +/* { dg-final { scan-assembler-times "fmrrd\[\\t \]+r0,\[\\t \]*r1,\[\\t \]*d0" 2 } } */