This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Committed: Switch K8 processors to PTA_NO_SAHF


We learned the hard way that some K8 processors also lack SAHF
instruction. All K8 processors have to be switched to PTA_NO_SAHF, but
the support can still be detected with -march=native.

BTW: There is an AMD errata in this area:

--cut here--
110 SAHF/LAHF Extended Feature Flag Defaults to Incorrect Value


The Extended Feature Flag bit defined for SAHF and LAHF instruction
support in 64-bit mode is ECX[0]. However some processors that support
the feature incorrectly return it as zero.

Potential Effect on System

The operating system will not see the feature flag and therefore the
extended feature will not be used.

Suggested Workaround

For processors which support the feature (as determined by the
processor revision ID), BIOS should write a one to:

• MSR C001_100Dh, bit 32 for revision D silicon.

• MSR C001_1005h, bit 32 for revision E and later silicon.

This will cause the extended feature flag in ECX[0] to be set.

Fix Planned

--cut here--

2007-03-16 Uros Bizjak <>

       * config/i386/i386.c (override_options): Add PTA_NO_SAHF to k8,
       opteron, athlon-64 and athlon-fx processor_alias_table entries.

Patch is bootstrapped on i686-pc-linux-gnu, commited to SVN mainline.



Attachment: i386-amd-no-sahf.diff
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]