[PATCH, i386]: Add arch flag for sahf instruction

Jan Hubicka jh@suse.cz
Thu Mar 8 13:22:00 GMT 2007

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


More information about the Gcc-patches mailing list