X86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported
authorHans Wennborg <hans@hanshq.net>
Fri, 4 Dec 2015 23:00:33 +0000 (23:00 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 4 Dec 2015 23:00:33 +0000 (23:00 +0000)
commit35cba4cf6a352382826c0daf86108898807e4910
tree7f4783e4c0585ae4f239db96ed5c7704e113a1db
parenta7a95fed0f4e64e5a0c8836db68be8964fdc10c7
X86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported

These instructions are not supported by all CPUs in 64-bit mode. Emitting them
causes Chromium to crash on start-up for users with such chips.

(GCC puts these instructions behind -msahf on 64-bit for the same reason.)

This patch adds FeatureLAHFSAHF, enables it by default for 32-bit targets
and modern CPUs, and changes X86InstrInfo::copyPhysReg back to the lowering
from before r244503 when the instructions are not available.

Differential Revision: http://reviews.llvm.org/D15240

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254793 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86.td
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86Subtarget.h
test/CodeGen/X86/cmpxchg-clobber-flags.ll
test/CodeGen/X86/peephole-na-phys-copy-folding.ll