This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Add arch flag for sahf instruction
On Thu, Mar 08, 2007 at 12:40:46PM +0100, Jan Hubicka wrote:
> > On 3/7/07, Richard Henderson <rth@redhat.com> wrote:
> >
> > >This is not something appropriate for tune, because it
> > >does *not* work for a subset of the 64-bit chips. It
> > >would have to be an arch switch instead.
> >
> > Attached patch adds arch flag for sahf instruction. in x86_64, I
> > propose following:
> >
> > gcc -march=(any 64bit arch) generates sahf instruction depending on tune
> > flags.
> > gcc -mtune=(any 64bit arch) does not generate sahf instruction.
> >
> > This solves the problem of supporting very old x86_64 prototypes. gcc
> > does not generate sahf by default, but -march= switch implies that
> > user has recent enough processor. However, there is no problem to
> > switch sahf off on a per-processor basis by adding TARGET_NO_SAHF to
> > affected processor flags.
> >
> > Also, this patch cleans handling of TARGET_USE_SAHF flag through the
> > sources.
>
> The patch is fine with me, just I think H. J. should comment on whether
> -march=nocona should use sahf or not. I believe it is not only about
> very old prototypes, but also about early production machines.
> (at least my Nocna box does reject SAHF)
-march=nocona shouldn't use sahf. However, -machine=native should
check the lahf_lm bit.
H.J.