[PATCH] D15240: X86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 11:42:59 PST 2015


hans created this revision.
hans added reviewers: jfb, majnemer, eliben, rnk.
hans added subscribers: llvm-commits, thakis.

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

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

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

I'm not familiar with all the x86 CPU models, but I believe the ones I updated are all modern enough.

Please take a look.

http://reviews.llvm.org/D15240

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15240.41901.patch
Type: text/x-patch
Size: 16890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151204/67eb2e21/attachment.bin>


More information about the llvm-commits mailing list