[PATCH] D109097: [X86] Remove isel predicates for xgetbv/xsetbv instructions so they can work on Windows.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 10:25:39 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3e89cc5cda22: [X86] Remove isel predicates for xgetbv/xsetbv instructions so they can work on… (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109097/new/

https://reviews.llvm.org/D109097

Files:
  llvm/lib/Target/X86/X86InstrSystem.td
  llvm/test/CodeGen/X86/system-intrinsics-xsetbv.ll


Index: llvm/test/CodeGen/X86/system-intrinsics-xsetbv.ll
===================================================================
--- llvm/test/CodeGen/X86/system-intrinsics-xsetbv.ll
+++ llvm/test/CodeGen/X86/system-intrinsics-xsetbv.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+xsave | FileCheck %s
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xsave | FileCheck %s --check-prefix=CHECK64
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=CHECK64
 
 define void @test_xsetbv(i32 %in, i32 %high, i32 %low) {
 ; CHECK-LABEL: test_xsetbv
Index: llvm/lib/Target/X86/X86InstrSystem.td
===================================================================
--- llvm/lib/Target/X86/X86InstrSystem.td
+++ llvm/lib/Target/X86/X86InstrSystem.td
@@ -529,16 +529,17 @@
 //===----------------------------------------------------------------------===//
 // XSAVE instructions
 let SchedRW = [WriteSystem] in {
-let Predicates = [HasXSAVE] in {
+// NOTE: No HasXSAVE predicate so that these can be used with _xgetbv/_xsetbv
+// on Windows without needing to enable the xsave feature to be compatible with
+// MSVC.
 let Defs = [EDX, EAX], Uses = [ECX] in
-  def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, PS;
+def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, PS;
 
 let Uses = [EDX, EAX, ECX] in
-  def XSETBV : I<0x01, MRM_D1, (outs), (ins),
-                "xsetbv",
-                [(int_x86_xsetbv ECX, EDX, EAX)]>, PS;
+def XSETBV : I<0x01, MRM_D1, (outs), (ins),
+              "xsetbv",
+              [(int_x86_xsetbv ECX, EDX, EAX)]>, PS;
 
-} // HasXSAVE
 
 let Uses = [EDX, EAX] in {
 def XSAVE : I<0xAE, MRM4m, (outs), (ins opaquemem:$dst),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109097.370319.patch
Type: text/x-patch
Size: 1787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210902/7a070fbc/attachment.bin>


More information about the llvm-commits mailing list