From: Craig Topper Date: Wed, 8 Feb 2017 05:45:46 +0000 (+0000) Subject: [X86] Add test for clflushopt intrinsic and only enable it to be selected if the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9deafaebfe0adb3981420cb51e8a21263be0c9f8;p=llvm [X86] Add test for clflushopt intrinsic and only enable it to be selected if the feature flag is set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294407 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index 7087fe9dcd8..7bdf2bd41b1 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -862,6 +862,7 @@ def HasMWAITX : Predicate<"Subtarget->hasMWAITX()">; def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">; def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">; def HasMPX : Predicate<"Subtarget->hasMPX()">; +def HasCLFLUSHOPT : Predicate<"Subtarget->hasCLFLUSHOPT()">; def HasCmpxchg16b: Predicate<"Subtarget->hasCmpxchg16b()">; def Not64BitMode : Predicate<"!Subtarget->is64Bit()">, AssemblerPredicate<"!Mode64Bit", "Not 64-bit mode">; @@ -2529,6 +2530,7 @@ let Predicates = [HasTBM] in { // Memory Instructions // +let Predicates = [HasCLFLUSHOPT] in def CLFLUSHOPT : I<0xAE, MRM7m, (outs), (ins i8mem:$src), "clflushopt\t$src", [(int_x86_clflushopt addr:$src)]>, PD; def CLWB : I<0xAE, MRM6m, (outs), (ins i8mem:$src), "clwb\t$src", []>, PD; diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index f9ae5a4fc2d..633c7adda2f 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -487,6 +487,7 @@ public: bool hasVLX() const { return HasVLX; } bool hasPKU() const { return HasPKU; } bool hasMPX() const { return HasMPX; } + bool hasCLFLUSHOPT() const { return HasCLFLUSHOPT; } bool isXRaySupported() const override { return is64Bit(); } diff --git a/test/CodeGen/X86/clflushopt.ll b/test/CodeGen/X86/clflushopt.ll new file mode 100644 index 00000000000..ee416eb96c5 --- /dev/null +++ b/test/CodeGen/X86/clflushopt.ll @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=clflushopt | FileCheck %s + +define void @clflushopt(i8* %p) nounwind { +; CHECK-LABEL: clflushopt: +; CHECK: ## BB#0: +; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT: clflushopt (%eax) +; CHECK-NEXT: retl + tail call void @llvm.x86.clflushopt(i8* %p) + ret void +} +declare void @llvm.x86.clflushopt(i8*) nounwind