Skip to content

Commit

Permalink
[X86] Add WRMSRNS instructions.
Browse files Browse the repository at this point in the history
For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D135935
  • Loading branch information
FreddyLeaf committed Oct 19, 2022
1 parent 7a4e56a commit 3ee58e2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Changes to the X86 Backend
--------------------------

* Add support for the ``RDMSRLIST and WRMSRLIST`` instructions.
* Add support for the ``WRMSRNS`` instruction.

Changes to the OCaml bindings
-----------------------------
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/X86/X86InstrSystem.td
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src),
let SchedRW = [WriteSystem] in {
let Uses = [EAX, ECX, EDX] in
def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB;
let Uses = [EAX, ECX, EDX] in
def WRMSRNS : I<0x01, MRM_C6, (outs), (ins), "wrmsrns", []>, PS;
let Defs = [EAX, EDX], Uses = [ECX] in
def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB;

Expand Down
8 changes: 8 additions & 0 deletions llvm/test/MC/Disassembler/X86/wrmsrns.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s --check-prefixes=ATT
# RUN: llvm-mc --disassemble %s -triple=x86_64 -x86-asm-syntax=intel --output-asm-variant=1 | FileCheck %s --check-prefixes=INTEL
# RUN: llvm-mc --disassemble %s -triple=i386 | FileCheck %s --check-prefixes=ATT
# RUN: llvm-mc --disassemble %s -triple=i386 -x86-asm-syntax=intel --output-asm-variant=1 | FileCheck %s --check-prefixes=INTEL

# ATT: wrmsrns
# INTEL: wrmsrns
0x0f,0x01,0xc6
8 changes: 8 additions & 0 deletions llvm/test/MC/X86/wrmsrns.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: llvm-mc -triple x86_64 --show-encoding %s | FileCheck %s
// RUN: llvm-mc -triple x86_64 -x86-asm-syntax=intel -output-asm-variant=1 --show-encoding %s | FileCheck %s
// RUN: llvm-mc -triple i386 --show-encoding %s | FileCheck %s
// RUN: llvm-mc -triple i386 -x86-asm-syntax=intel -output-asm-variant=1 --show-encoding %s | FileCheck %s

// CHECK: wrmsrns
// CHECK: encoding: [0x0f,0x01,0xc6]
wrmsrns

0 comments on commit 3ee58e2

Please sign in to comment.