From 3d3e1b8fee2897980e2ef991df223dc8dfc9155c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 8 Aug 2019 18:11:17 +0000 Subject: [PATCH] [X86] Make CMPXCHG16B feature imply CMPXCHG8B feature. This fixes znver1 so that it properly enables CMPXHG8B. We can probably remove explicit CMPXCHG8B from CPUs that also have CMPXCHG16B, but keeping this simple to allow cherry pick to 9.0. Fixes PR42935. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368324 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86.td | 3 ++- test/CodeGen/X86/cmpxchg8b.ll | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Target/X86/X86.td b/lib/Target/X86/X86.td index e53c7528734..d5f4a72cafc 100644 --- a/lib/Target/X86/X86.td +++ b/lib/Target/X86/X86.td @@ -95,7 +95,8 @@ def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA", def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true", "Support 64-bit instructions">; def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true", - "64-bit with cmpxchg16b">; + "64-bit with cmpxchg16b", + [FeatureCMPXCHG8B]>; def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true", "SHLD instruction is slow">; def FeatureSlowPMULLD : SubtargetFeature<"slow-pmulld", "IsPMULLDSlow", "true", diff --git a/test/CodeGen/X86/cmpxchg8b.ll b/test/CodeGen/X86/cmpxchg8b.ll index 8eb3dda6b6e..caf40c541e2 100644 --- a/test/CodeGen/X86/cmpxchg8b.ll +++ b/test/CodeGen/X86/cmpxchg8b.ll @@ -2,6 +2,7 @@ ; RUN: llc < %s -mtriple=i686-unknown- -mcpu=core2 | FileCheck %s --check-prefixes=CHECK,X86 ; RUN: llc < %s -mtriple=x86_64-unknown- -mcpu=core2 | FileCheck %s --check-prefixes=CHECK,X64 ; RUN: llc < %s -mtriple=i686-unknown- -mcpu=i486 | FileCheck %s --check-prefixes=I486 +; RUN: llc < %s -mtriple=i686-unknown- -mcpu=znver1 | FileCheck %s --check-prefixes=CHECK,X86 ; Basic 64-bit cmpxchg define void @t1(i64* nocapture %p) nounwind ssp {