Message ID | 006101ccd676$0c8d17c0$25a74740$@cheng@arm.com |
---|---|
State | New |
Headers | show |
On 19/01/12 06:46, Bin Cheng wrote: > Hi, > Currently gcc generates code violating ARM EABI when passing arguments to > some floating point > helper functions, which are __aeabi_d2iz/__aeabi_d2uiz. As reported in bug > PR51835. > > This patch fixes the issue, with test cases. > > It is for trunk and 4.6 branch, and I have checked the output codes > manually. > Is it OK? > > Thanks > > gcc/ChangeLog: > 2012-01-17 Bin Cheng <bin.cheng@arm.com> > > PR target/51835 > * config/arm/arm.c (arm_libcall_uses_aapcs_base): Use correct ABI > for > __aeabi_d2iz/__aeabi_d2uiz in hard-float abi if only > single-precision > arithmetic is supported in hardware. > > gcc/testsuite/ChangeLog: > 2012-01-17 Bin Cheng <bin.cheng@arm.com> > > PR target/51835 > * testsuite/gcc.target/arm/pr51835.c: New testcase. > > OK both. R.
Index: gcc/testsuite/gcc.target/arm/pr51835.c =================================================================== --- gcc/testsuite/gcc.target/arm/pr51835.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr51835.c (revision 0) @@ -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 } } */ Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 183205) +++ gcc/config/arm/arm.c (working copy) @@ -3680,6 +3680,10 @@ 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, convert_optab_libfunc (ufix_optab, DImode, DFmode));