[llvm] r329936 - [X86] Introduce LLVM wbinvd intrinsic
Gabor Buella via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 11:38:18 PDT 2018
Author: gbuella
Date: Thu Apr 12 11:38:18 2018
New Revision: 329936
URL: http://llvm.org/viewvc/llvm-project?rev=329936&view=rev
Log:
[X86] Introduce LLVM wbinvd intrinsic
A previously missing intrinsic for an old instruction.
Reviewers: craig.topper, echristo
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D45312
Added:
llvm/trunk/test/CodeGen/X86/wbinvd-intrinsic.ll
Modified:
llvm/trunk/include/llvm/IR/IntrinsicsX86.td
llvm/trunk/lib/Target/X86/X86InstrSystem.td
Modified: llvm/trunk/include/llvm/IR/IntrinsicsX86.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsX86.td?rev=329936&r1=329935&r2=329936&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsX86.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsX86.td Thu Apr 12 11:38:18 2018
@@ -6403,10 +6403,14 @@ let TargetPrefix = "x86" in {
}
//===----------------------------------------------------------------------===//
-// Cache line write back intrinsics
+// Cache write back intrinsics
-// Write back no-invalidate
let TargetPrefix = "x86" in {
+ // Write back and invalidate
+ def int_x86_wbinvd : GCCBuiltin<"__builtin_ia32_wbinvd">,
+ Intrinsic<[], [], []>;
+
+ // Write back no-invalidate
def int_x86_wbnoinvd : GCCBuiltin<"__builtin_ia32_wbnoinvd">,
Intrinsic<[], [], []>;
}
Modified: llvm/trunk/lib/Target/X86/X86InstrSystem.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSystem.td?rev=329936&r1=329935&r2=329936&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSystem.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSystem.td Thu Apr 12 11:38:18 2018
@@ -442,7 +442,7 @@ let Defs = [EAX, EBX, ECX, EDX], Uses =
// Cache instructions
let SchedRW = [WriteSystem] in {
def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB;
-def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB;
+def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [(int_x86_wbinvd)]>, TB;
// wbnoinvd is like wbinvd, except without invalidation
// encoding: like wbinvd + an 0xF3 prefix
Added: llvm/trunk/test/CodeGen/X86/wbinvd-intrinsic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/wbinvd-intrinsic.ll?rev=329936&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/wbinvd-intrinsic.ll (added)
+++ llvm/trunk/test/CodeGen/X86/wbinvd-intrinsic.ll Thu Apr 12 11:38:18 2018
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=i686
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=x86_64
+
+define void @test_wbinvd() {
+; i686-LABEL: test_wbinvd:
+; i686: # %bb.0:
+; i686-NEXT: wbinvd
+; i686-NEXT: retl
+;
+; x86_64-LABEL: test_wbinvd:
+; x86_64: # %bb.0:
+; x86_64-NEXT: wbinvd
+; x86_64-NEXT: retq
+ call void @llvm.x86.wbinvd()
+ ret void
+}
+
+declare void @llvm.x86.wbinvd()
More information about the llvm-commits
mailing list