[X86] Add test for clflushopt intrinsic and only enable it to be selected if the feature flag is set.

llvm-svn: 294407
This commit is contained in:
Craig Topper 2017-02-08 05:45:46 +00:00
parent 3079e57bb9
commit 5eaada1e12
3 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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(); }

View File

@ -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