[PATCH] D89198: [X86] Define __LAHF_SAHF__ if feature 'sahf' is set
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 10 19:22:54 PDT 2020
MaskRay added inline comments.
================
Comment at: clang/lib/Basic/Targets/X86.cpp:564
+ if (HasLAHFSAHF)
+ Builder.defineMacro("__LAHF_SAHF__");
if (HasLZCNT)
----------------
craig.topper wrote:
> craig.topper wrote:
> > It looks like gcc may define this always in 32-bit mode?
> More confusingly, they define it in 32-bit mode unless -mno-sahf is on the command line. Despite 32-bit mode always having LAHF/SAHF instructions.
I think this means we fail to set sahf for all 32-bit CPUs. GCC gcc/config/i386/i386-options.c sets OPTION_MASK_ISA_SAHF on all 32-bit CPUs unless -mno-sahf.
According to https://git.noc.ruhr-uni-bochum.de/kostea7x/ghidra/-/commit/239106a356ef8555575a64cc2cfd3fd71b415406?view=parallel
some pre-2005 Intel and AMD 64-bit CPUs had problems so 'sahf' is disabled for some CPUs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89198/new/
https://reviews.llvm.org/D89198
More information about the cfe-commits
mailing list