Skip to content

Commit d9cfddc

Browse files
committed
Add X86 disassembler support for RDFSBASE, RDGSBASE, WRFSBASE, and WRGSBASE.
llvm-svn: 141358
1 parent 35c9e51 commit d9cfddc

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

llvm/lib/Target/X86/X86InstrSystem.td

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", []>, TB;
400400
def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB;
401401
def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB;
402402

403+
//===----------------------------------------------------------------------===//
404+
// XSAVE instructions
403405
let Defs = [RDX, RAX], Uses = [RCX] in
404406
def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
405407

@@ -442,3 +444,24 @@ let Defs = [RAX, RSI, RDI], Uses = [RAX, RSI, RDI] in {
442444
}
443445
let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in
444446
def MONTMUL : I<0xc0, RawFrm, (outs), (ins), "montmul", []>, A6;
447+
448+
//===----------------------------------------------------------------------===//
449+
// FS/GS Base Instructions
450+
let Predicates = [In64BitMode] in {
451+
def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins),
452+
"rdfsbase{l}\t$dst", []>, TB, XS;
453+
def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins),
454+
"rdfsbase{q}\t$dst", []>, TB, XS;
455+
def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins),
456+
"rdgsbase{l}\t$dst", []>, TB, XS;
457+
def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins),
458+
"rdgsbase{q}\t$dst", []>, TB, XS;
459+
def WRFSBASE : I<0xAE, MRM2r, (outs), (ins GR32:$dst),
460+
"wrfsbase{l}\t$dst", []>, TB, XS;
461+
def WRFSBASE64 : RI<0xAE, MRM2r, (outs), (ins GR64:$dst),
462+
"wrfsbase{q}\t$dst", []>, TB, XS;
463+
def WRGSBASE : I<0xAE, MRM3r, (outs), (ins GR32:$dst),
464+
"wrgsbase{l}\t$dst", []>, TB, XS;
465+
def WRGSBASE64 : RI<0xAE, MRM3r, (outs), (ins GR64:$dst),
466+
"wrgsbase{q}\t$dst", []>, TB, XS;
467+
}

llvm/test/MC/Disassembler/X86/simple-tests.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,27 @@
431431

432432
# CHECK: xsaveopt (%rax)
433433
0x0f 0xae 0x30
434+
435+
# CHECK rdfsbasel %eax
436+
0xf3 0x0f 0xae 0xc0
437+
438+
# CHECK rdgsbasel %eax
439+
0xf3 0x0f 0xae 0xc8
440+
441+
# CHECK wrfsbasel %eax
442+
0xf3 0x0f 0xae 0xd0
443+
444+
# CHECK wrgsbasel %eax
445+
0xf3 0x0f 0xae 0xd8
446+
447+
# CHECK rdfsbaseq %rax
448+
0xf3 0x48 0x0f 0xae 0xc0
449+
450+
# CHECK rdgsbaseq %rax
451+
0xf3 0x48 0x0f 0xae 0xc8
452+
453+
# CHECK wrfsbaseq %rax
454+
0xf3 0x48 0x0f 0xae 0xd0
455+
456+
# CHECK wrgsbaseq %rax
457+
0xf3 0x48 0x0f 0xae 0xd8

0 commit comments

Comments
 (0)