public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
@ 2012-01-12  8:01 amker.cheng at gmail dot com
  2012-01-16  9:50 ` [Bug target/51835] " rearnsha at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: amker.cheng at gmail dot com @ 2012-01-12  8:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

             Bug #: 51835
           Summary: ARM EABI violation when passing arguments to helper
                    floating functions like __aeabi_d2iz
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amker.cheng@gmail.com


For following program
int func(float f)
{
  double d = (double)f;
  return (int)d;
}
compile it with following command:
$ arm-none-eabi-gcc -O2 -mthumb -mcpu=cortex-m4 -mfloat-abi=hard
-mfpu=fpv4-sp-d16 -S test.c -o test.S

the generated assembly code is:
-----------------------------------------------
fun:
    @ args = 0, pretend = 0, frame = 0
    @ frame_needed = 0, uses_anonymous_args = 0
    push    {r3, lr}
    fmrs    r0, s0
    bl    __aeabi_f2d
    fmdrr    d0, r0, r1
    bl    __aeabi_d2iz
    pop    {r3, pc}
    .size    fun, .-fun

The argument of __aeabi_d2iz is passed in fp register, While ARM RTABI document
says that such functions should use the soft-float ABI, even when
-mfloat-abi=hard is specified.

The problem at least exists on trunk and 4.6 branch.

I am working a patch and will send it for review later.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
@ 2012-01-16  9:50 ` rearnsha at gcc dot gnu.org
  2012-01-19 23:08 ` ramana at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2012-01-16  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-16
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2012-01-16 09:37:33 UTC ---
Confirmed


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
  2012-01-16  9:50 ` [Bug target/51835] " rearnsha at gcc dot gnu.org
@ 2012-01-19 23:08 ` ramana at gcc dot gnu.org
  2012-01-30 18:05 ` jye2 at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2012-01-19 23:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org
   Target Milestone|---                         |4.6.3
      Known to fail|                            |4.6.0, 4.6.1, 4.6.2, 4.7.0

--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2012-01-19 22:40:51 UTC ---
This is only applicable to the 4.6 branch and trunk since support for the
Cortex M4 wasn't added till 4.6. 

cheers
Ramana


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
  2012-01-16  9:50 ` [Bug target/51835] " rearnsha at gcc dot gnu.org
  2012-01-19 23:08 ` ramana at gcc dot gnu.org
@ 2012-01-30 18:05 ` jye2 at gcc dot gnu.org
  2012-01-30 18:35 ` jye2 at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jye2 at gcc dot gnu.org @ 2012-01-30 18:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

--- Comment #3 from jye2 at gcc dot gnu.org 2012-01-30 16:59:21 UTC ---
Author: jye2
Date: Mon Jan 30 16:59:14 2012
New Revision: 183733

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183733
Log:
2012-01-30  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 with hard-float.

testcases:
    PR target/51835
    * gcc.target/arm/pr51835.c: New testcase.


Added:
    trunk/gcc/testsuite/gcc.target/arm/pr51835.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (2 preceding siblings ...)
  2012-01-30 18:05 ` jye2 at gcc dot gnu.org
@ 2012-01-30 18:35 ` jye2 at gcc dot gnu.org
  2012-02-05 14:08 ` mikpe at it dot uu.se
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jye2 at gcc dot gnu.org @ 2012-01-30 18:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

--- Comment #4 from jye2 at gcc dot gnu.org 2012-01-30 17:22:08 UTC ---
Author: jye2
Date: Mon Jan 30 17:22:04 2012
New Revision: 183734

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183734
Log:
2012-01-30  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 with hard-float.

testcases:
    PR target/51835
    * gcc.target/arm/pr51835.c: New testcase.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/arm/pr51835.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/arm/arm.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (3 preceding siblings ...)
  2012-01-30 18:35 ` jye2 at gcc dot gnu.org
@ 2012-02-05 14:08 ` mikpe at it dot uu.se
  2012-02-06  5:52 ` amker.cheng at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikpe at it dot uu.se @ 2012-02-05 14:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2012-02-05 14:07:49 UTC ---
(In reply to comment #2)
> This is only applicable to the 4.6 branch and trunk since support for the
> Cortex M4 wasn't added till 4.6. 
> 
> cheers
> Ramana

Maybe the Cortex M4 wasn't added until 4.6, but the other options are permitted
by 4.5 and I can easily get 4.5 to produce wrong-looking code.  With -O2
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7-a -marm I see the following
code generation difference between 4.5 and 4.6:

@@ -22,8 +22,9 @@
        @ frame_needed = 0, uses_anonymous_args = 0
        stmfd   sp!, {r3, lr}
        bl      __aeabi_f2d
+       fmrrd   r0, r1, d0
        bl      __aeabi_d2iz
        ldmfd   sp!, {r3, pc}
        .size   func, .-func
-       .ident  "GCC: (GNU) 4.5.4 20120126 (prerelease)"
+       .ident  "GCC: (GNU) 4.6.3 20120203 (prerelease)"
        .section        .note.GNU-stack,"",%progbits

Backporting r183734 from 4.6 to 4.5 makes 4.5 generate the same code as 4.6,
i.e., with the fmrrd between the two calls.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (4 preceding siblings ...)
  2012-02-05 14:08 ` mikpe at it dot uu.se
@ 2012-02-06  5:52 ` amker.cheng at gmail dot com
  2012-02-10  3:15 ` amker at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amker.cheng at gmail dot com @ 2012-02-06  5:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

--- Comment #6 from amker.cheng <amker.cheng at gmail dot com> 2012-02-06 05:51:25 UTC ---
(In reply to comment #5)
> (In reply to comment #2)
> > This is only applicable to the 4.6 branch and trunk since support for the
> > Cortex M4 wasn't added till 4.6. 
> > 
> > cheers
> > Ramana
> 
> Maybe the Cortex M4 wasn't added until 4.6, but the other options are permitted
> by 4.5 and I can easily get 4.5 to produce wrong-looking code.  With -O2
> -mfloat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7-a -marm I see the following
> code generation difference between 4.5 and 4.6:
> 
> @@ -22,8 +22,9 @@
>         @ frame_needed = 0, uses_anonymous_args = 0
>         stmfd   sp!, {r3, lr}
>         bl      __aeabi_f2d
> +       fmrrd   r0, r1, d0
>         bl      __aeabi_d2iz
>         ldmfd   sp!, {r3, pc}
>         .size   func, .-func
> -       .ident  "GCC: (GNU) 4.5.4 20120126 (prerelease)"
> +       .ident  "GCC: (GNU) 4.6.3 20120203 (prerelease)"
>         .section        .note.GNU-stack,"",%progbits
> 
> Backporting r183734 from 4.6 to 4.5 makes 4.5 generate the same code as 4.6,
> i.e., with the fmrrd between the two calls.

beside this patch, Julian Brown's patch r174803 is necessary too.

For now,
1, arguments for both __aeabi_f2d and __aeabi_d2iz are wrong in 4.5;
2, arguments for __aeabi_f2d is wrong in 4.6
To solve this, have to:
1, backport r183734 and r174803 to 4.5;
2, backport r174803 to 4.6;


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (5 preceding siblings ...)
  2012-02-06  5:52 ` amker.cheng at gmail dot com
@ 2012-02-10  3:15 ` amker at gcc dot gnu.org
  2012-02-14  7:43 ` amker at gcc dot gnu.org
  2012-02-23  2:43 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: amker at gcc dot gnu.org @ 2012-02-10  3:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

--- Comment #7 from amker at gcc dot gnu.org 2012-02-10 03:14:45 UTC ---
Author: amker
Date: Fri Feb 10 03:14:40 2012
New Revision: 184082

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184082
Log:
    Backport from mainline.
    2012-01-30  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 with hard-float.

    Backport from mainline.
    2012-01-30  Bin Cheng  <bin.cheng@arm.com>

    PR target/51835
    * gcc.target/arm/pr51835.c: New testcase.


Added:
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.target/arm/pr51835.c
Modified:
    branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (6 preceding siblings ...)
  2012-02-10  3:15 ` amker at gcc dot gnu.org
@ 2012-02-14  7:43 ` amker at gcc dot gnu.org
  2012-02-23  2:43 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: amker at gcc dot gnu.org @ 2012-02-14  7:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

--- Comment #8 from amker at gcc dot gnu.org 2012-02-14 07:42:47 UTC ---
Author: amker
Date: Tue Feb 14 07:42:41 2012
New Revision: 184197

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184197
Log:

    Backport from mainline.
    2012-01-30  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 with hard-float.

    2011-06-08  Julian Brown  <julian@codesourcery.com>

    * 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.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.target/arm/pr51835.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/config/arm/arm.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/51835] ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz
  2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
                   ` (7 preceding siblings ...)
  2012-02-14  7:43 ` amker at gcc dot gnu.org
@ 2012-02-23  2:43 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2012-02-23  2:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51835

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.6.3                       |4.5.4
      Known to fail|                            |4.5.3

--- Comment #9 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2012-02-23 02:33:30 UTC ---
Fixed I think now on all release branches where affected and trunk.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-02-23  2:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12  8:01 [Bug target/51835] New: ARM EABI violation when passing arguments to helper floating functions like __aeabi_d2iz amker.cheng at gmail dot com
2012-01-16  9:50 ` [Bug target/51835] " rearnsha at gcc dot gnu.org
2012-01-19 23:08 ` ramana at gcc dot gnu.org
2012-01-30 18:05 ` jye2 at gcc dot gnu.org
2012-01-30 18:35 ` jye2 at gcc dot gnu.org
2012-02-05 14:08 ` mikpe at it dot uu.se
2012-02-06  5:52 ` amker.cheng at gmail dot com
2012-02-10  3:15 ` amker at gcc dot gnu.org
2012-02-14  7:43 ` amker at gcc dot gnu.org
2012-02-23  2:43 ` ramana at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).