[PATCH] D45312: Introduce LLVM wbinvd intrinsic

Gabor Buella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 02:04:13 PDT 2018


GBuella created this revision.
GBuella added reviewers: craig.topper, echristo.
Herald added a subscriber: llvm-commits.

A previously missing intrinsic for an old instruction.


Repository:
  rL LLVM

https://reviews.llvm.org/D45312

Files:
  include/llvm/IR/IntrinsicsX86.td
  lib/Target/X86/X86InstrSystem.td
  test/CodeGen/X86/wbinvd-intrinsic.ll


Index: test/CodeGen/X86/wbinvd-intrinsic.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/wbinvd-intrinsic.ll
@@ -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()
Index: lib/Target/X86/X86InstrSystem.td
===================================================================
--- lib/Target/X86/X86InstrSystem.td
+++ lib/Target/X86/X86InstrSystem.td
@@ -481,7 +481,8 @@
 // Cache instructions
 let SchedRW = [WriteSystem] in {
 def INVD : I<0x08, RawFrm, (outs), (ins), "invd", [], IIC_INVD>, TB;
-def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [], IIC_INVD>, TB;
+def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd",
+              [(int_x86_wbinvd)], IIC_INVD>, TB;
 } // SchedRW
 
 //===----------------------------------------------------------------------===//
Index: include/llvm/IR/IntrinsicsX86.td
===================================================================
--- include/llvm/IR/IntrinsicsX86.td
+++ include/llvm/IR/IntrinsicsX86.td
@@ -6421,3 +6421,10 @@
   def int_x86_clzero : GCCBuiltin<"__builtin_ia32_clzero">,
       Intrinsic<[], [llvm_ptr_ty], []>;
 }
+
+//===----------------------------------------------------------------------===//
+// Cache write back intrinsics
+let TargetPrefix = "x86" in {
+  def int_x86_wbinvd : GCCBuiltin<"__builtin_ia32_wbinvd">,
+      Intrinsic<[], [], []>;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45312.141116.patch
Type: text/x-patch
Size: 1909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180405/dbf7088c/attachment.bin>


More information about the llvm-commits mailing list