public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RFC: Unsolicited usage of VFP registers for Cortex-M4F
@ 2012-09-24 10:31 Ilija Kocho
  2012-10-04  9:44 ` [RFC] " Ilija Kocho
  2012-10-09 10:15 ` Ilija Kocho
  0 siblings, 2 replies; 4+ messages in thread
From: Ilija Kocho @ 2012-09-24 10:31 UTC (permalink / raw)
  To: gcc-help

Hi colleagues

In a course of implementing lazy context switching I the following link
come to me:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DAFIFGGE.html

Here is a quote in case the link renders broken (in future):
-- Quote ------------


        GNUC C compiler (gcc)

If a program is compiled with the FPU option, gcc might make use of the
floating-point registers if register pressure is high, and running low
on available registers for data processing. In some cases, the memory
copy might also utilize floating-point registers to hold data.

It is possible to avoid the use of floating-point instructions in
non-floating-point code by using |-mfloat-abi=soft|.

By default, libraries are built with |-mfloat-abi=soft|. So they must
not contain floating-point instructions. However, because there are
various gcc vendors with different build options, you might have to
check with your gcc tool chain supplier to find out the status of the
libraries.

-- end of quote ---------

I did some research, googling and searching GCC mailing lists, and found
no other reference that would confirm/deny or put some light on above text.

Therefore here are my questions:

1) Does GCC use VFP registers for holding data other than floating point
values (unsolicited VFP usage)?

If (1) is true:
1.1) What conditions, in addition to selecting -mfloat-abi=hard (or
softfp) shall cause such behaviour. I would appreciate some test case.
1.2) Any pointer to source code responsible for this [optimization]? I
would appreciate this.
1.4) Can it be disabled? I found no such command line option for ARM
targets.

2) Above quote states that -mfloat-abi=soft should be used for libs, but
ld refuses to link them with code produced with -mfloat-abi=hard even if
the libs do not use floating point operations. Is there a waay to tweak
this?

I am especially intersted for Cortex-M4F architecture, but also I would
like to know about ARMv7 in general.

Regards
Ilija

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

* Re: [RFC] Unsolicited usage of VFP registers for Cortex-M4F
  2012-09-24 10:31 RFC: Unsolicited usage of VFP registers for Cortex-M4F Ilija Kocho
@ 2012-10-04  9:44 ` Ilija Kocho
  2012-10-09 10:15 ` Ilija Kocho
  1 sibling, 0 replies; 4+ messages in thread
From: Ilija Kocho @ 2012-10-04  9:44 UTC (permalink / raw)
  To: gcc-help

Hi again.

Nobody has commented yet on this subject so far. Maybe I should have
asked the questions at beginning rather than end of my mail. Here I
repeat my questions with some explanations.

1) Does GCC use VFP registers for holding data other than floating point
values, such as floating point variables (unsolicited VFP usage)? This would mean (probably large) program using exclusively integer expressions but compiled with -float-abi=hard.

If (1) is true:
1.1) What conditions (flags, expressions in the code, etc.), in addition to selecting -mfloat-abi=hard (or
softfp) shall cause such behaviour. I would appreciate some test case.

1.2) Any pointer to source code (in GCC tree) responsible for this [optimization]?

1.4) Can it be disabled? I found no such command line option for ARM
targets.

Regards
Ilija


On 24.09.2012 12:30, Ilija Kocho wrote:
> Hi colleagues
>
> In a course of implementing lazy context switching I the following link
> come to me:
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DAFIFGGE.html
>
> Here is a quote in case the link renders broken (in future):
> -- Quote ------------
>
>
>         GNUC C compiler (gcc)
>
> If a program is compiled with the FPU option, gcc might make use of the
> floating-point registers if register pressure is high, and running low
> on available registers for data processing. In some cases, the memory
> copy might also utilize floating-point registers to hold data.
>
> It is possible to avoid the use of floating-point instructions in
> non-floating-point code by using |-mfloat-abi=soft|.
>
> By default, libraries are built with |-mfloat-abi=soft|. So they must
> not contain floating-point instructions. However, because there are
> various gcc vendors with different build options, you might have to
> check with your gcc tool chain supplier to find out the status of the
> libraries.
>
> -- end of quote ---------
>
> I did some research, googling and searching GCC mailing lists, and found
> no other reference that would confirm/deny or put some light on above text.
>
> Therefore here are my questions:
>
> 1) Does GCC use VFP registers for holding data other than floating point
> values (unsolicited VFP usage)?
>
> If (1) is true:
> 1.1) What conditions, in addition to selecting -mfloat-abi=hard (or
> softfp) shall cause such behaviour. I would appreciate some test case.
> 1.2) Any pointer to source code responsible for this [optimization]? I
> would appreciate this.
> 1.4) Can it be disabled? I found no such command line option for ARM
> targets.
>
> 2) Above quote states that -mfloat-abi=soft should be used for libs, but
> ld refuses to link them with code produced with -mfloat-abi=hard even if
> the libs do not use floating point operations. Is there a waay to tweak
> this?
>
> I am especially intersted for Cortex-M4F architecture, but also I would
> like to know about ARMv7 in general.
>
> Regards
> Ilija
>

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

* Re: [RFC] Unsolicited usage of VFP registers for Cortex-M4F
  2012-09-24 10:31 RFC: Unsolicited usage of VFP registers for Cortex-M4F Ilija Kocho
  2012-10-04  9:44 ` [RFC] " Ilija Kocho
@ 2012-10-09 10:15 ` Ilija Kocho
  2012-10-09 10:22   ` Joey Ye
  1 sibling, 1 reply; 4+ messages in thread
From: Ilija Kocho @ 2012-10-09 10:15 UTC (permalink / raw)
  To: Joey Ye; +Cc: gcc-help, Terry Guo

Hi Joey

Here I forward you the email that I have posted to GCC help mailing list
recently.

Ilija

On 24.09.2012 12:30, Ilija Kocho wrote:
> Hi colleagues
>
> In a course of implementing lazy context switching I the following link
> come to me:
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DAFIFGGE.html
>
> Here is a quote in case the link renders broken (in future):
> -- Quote ------------
>
>
>         GNUC C compiler (gcc)
>
> If a program is compiled with the FPU option, gcc might make use of the
> floating-point registers if register pressure is high, and running low
> on available registers for data processing. In some cases, the memory
> copy might also utilize floating-point registers to hold data.
>
> It is possible to avoid the use of floating-point instructions in
> non-floating-point code by using |-mfloat-abi=soft|.
>
> By default, libraries are built with |-mfloat-abi=soft|. So they must
> not contain floating-point instructions. However, because there are
> various gcc vendors with different build options, you might have to
> check with your gcc tool chain supplier to find out the status of the
> libraries.
>
> -- end of quote ---------
>
> I did some research, googling and searching GCC mailing lists, and found
> no other reference that would confirm/deny or put some light on above text.
>
> Therefore here are my questions:
>
> 1) Does GCC use VFP registers for holding data other than floating point
> values (unsolicited VFP usage)?
>
> If (1) is true:
> 1.1) What conditions, in addition to selecting -mfloat-abi=hard (or
> softfp) shall cause such behaviour. I would appreciate some test case.
> 1.2) Any pointer to source code responsible for this [optimization]? I
> would appreciate this.
> 1.4) Can it be disabled? I found no such command line option for ARM
> targets.
>
> 2) Above quote states that -mfloat-abi=soft should be used for libs, but
> ld refuses to link them with code produced with -mfloat-abi=hard even if
> the libs do not use floating point operations. Is there a waay to tweak
> this?
>
> I am especially intersted for Cortex-M4F architecture, but also I would
> like to know about ARMv7 in general.
>
> Regards
> Ilija
>

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

* RE: [RFC] Unsolicited usage of VFP registers for Cortex-M4F
  2012-10-09 10:15 ` Ilija Kocho
@ 2012-10-09 10:22   ` Joey Ye
  0 siblings, 0 replies; 4+ messages in thread
From: Joey Ye @ 2012-10-09 10:22 UTC (permalink / raw)
  To: 'Ilija Kocho'; +Cc: gcc-help, Terry Guo



> -----Original Message-----
> From: Ilija Kocho [mailto:ilijak@siva.com.mk]
> Sent: Tuesday, October 09, 2012 18:16
> To: Joey Ye
> Cc: gcc-help@gcc.gnu.org; Terry Guo
> Subject: Re: [RFC] Unsolicited usage of VFP registers for Cortex-M4F
> 
> Hi Joey
> 
> Here I forward you the email that I have posted to GCC help mailing
> list
> recently.
> 
> Ilija
> 
> On 24.09.2012 12:30, Ilija Kocho wrote:
> > Hi colleagues
> >
> > In a course of implementing lazy context switching I the following
> link
> > come to me:
> >
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0298a/DA
> FIFGGE.html
> >
> > Here is a quote in case the link renders broken (in future):
> > -- Quote ------------
> >
> >
> >         GNUC C compiler (gcc)
> >
> > If a program is compiled with the FPU option, gcc might make use of
> the
> > floating-point registers if register pressure is high, and running
> low
> > on available registers for data processing. In some cases, the memory
> > copy might also utilize floating-point registers to hold data.
> >
> > It is possible to avoid the use of floating-point instructions in
> > non-floating-point code by using |-mfloat-abi=soft|.
> >
> > By default, libraries are built with |-mfloat-abi=soft|. So they must
> > not contain floating-point instructions. However, because there are
> > various gcc vendors with different build options, you might have to
> > check with your gcc tool chain supplier to find out the status of the
> > libraries.
> >
> > -- end of quote ---------
> >
> > I did some research, googling and searching GCC mailing lists, and
> found
> > no other reference that would confirm/deny or put some light on above
> text.
> >
> > Therefore here are my questions:
> >
> > 1) Does GCC use VFP registers for holding data other than floating
> point
> > values (unsolicited VFP usage)?
It doesn't so far. Although GCC has no problem use FP for non-FP, the cost
model in ARM backend says using VFP isn't performing better than otherwise. 

For Cortex-M4F this isn't the best approach. I worked out a patch to tune
the cost model for M4F together with an option to enable/disable it. I'm
hoping to submit it later this year and it should enable Cortex-M4F to use
VFP extensively for non-FP data when option enabled.

> >
> > If (1) is true:
> > 1.1) What conditions, in addition to selecting -mfloat-abi=hard (or
> > softfp) shall cause such behaviour. I would appreciate some test case.
When the patch is upstreamed, and given that -ffpreg-for-nonfpdata is
provided, VFP will be used for non-FP data when ever register pressure is
high.

> > 1.2) Any pointer to source code responsible for this [optimization]?
> I
> > would appreciate this.
You can take a look at arm_register_move_cost. But there is more work to do
as a couple of reload hooks need to be fixed before it works correctly.

> > 1.4) Can it be disabled? I found no such command line option for ARM
> > targets.
The command line will be as -f[no-]fpreg-for-nonfpdata
> >
> > 2) Above quote states that -mfloat-abi=soft should be used for libs,
> but
> > ld refuses to link them with code produced with -mfloat-abi=hard even
> if
> > the libs do not use floating point operations. Is there a waay to
> tweak
> > this?
The quote isn't accurate nowadays. More and more libraries are built with
hard. Also a mechanism called multilib enables you to pick soft or hard
automatically according to linker command line
> >
> > I am especially intersted for Cortex-M4F architecture, but also I
> would
> > like to know about ARMv7 in general.
> >
> > Regards
> > Ilija
> >
> 
Thanks - Joey



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

end of thread, other threads:[~2012-10-09 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-24 10:31 RFC: Unsolicited usage of VFP registers for Cortex-M4F Ilija Kocho
2012-10-04  9:44 ` [RFC] " Ilija Kocho
2012-10-09 10:15 ` Ilija Kocho
2012-10-09 10:22   ` Joey Ye

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