From b779033a23c49c2e5e02b15a87bbae42973287b3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 13 Feb 2010 03:42:24 +0000 Subject: [PATCH] add encoder support and tests for rdtscp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96076 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrInfo.h | 1 + lib/Target/X86/X86MCCodeEmitter.cpp | 4 ++++ test/MC/AsmParser/X86/x86_32-new-encoder.s | 5 +++++ test/MC/Disassembler/simple-tests.txt | 5 ++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 9f50178fe67..5111719a209 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -279,6 +279,7 @@ namespace X86II { MRM_E8 = 39, MRM_F0 = 40, MRM_F8 = 41, + MRM_F9 = 42, FormMask = 63, diff --git a/lib/Target/X86/X86MCCodeEmitter.cpp b/lib/Target/X86/X86MCCodeEmitter.cpp index 1dc592ce7c3..2c7b9d82dea 100644 --- a/lib/Target/X86/X86MCCodeEmitter.cpp +++ b/lib/Target/X86/X86MCCodeEmitter.cpp @@ -617,6 +617,10 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, EmitByte(BaseOpcode, CurByte, OS); EmitByte(0xF8, CurByte, OS); break; + case X86II::MRM_F9: + EmitByte(BaseOpcode, CurByte, OS); + EmitByte(0xF9, CurByte, OS); + break; } // If there is a remaining operand, it must be a trailing immediate. Emit it diff --git a/test/MC/AsmParser/X86/x86_32-new-encoder.s b/test/MC/AsmParser/X86/x86_32-new-encoder.s index efac73f845e..6fd0cbb9164 100644 --- a/test/MC/AsmParser/X86/x86_32-new-encoder.s +++ b/test/MC/AsmParser/X86/x86_32-new-encoder.s @@ -29,6 +29,11 @@ // CHECK: swapgs // CHECK: encoding: [0x0f,0x01,0xf8] +rdtscp +// CHECK: rdtscp +// CHECK: encoding: [0x0f,0x01,0xf9] + + // CHECK: movl %eax, 16(%ebp) # encoding: [0x89,0x45,0x10] movl %eax, 16(%ebp) // CHECK: movl %eax, -16(%ebp) # encoding: [0x89,0x45,0xf0] diff --git a/test/MC/Disassembler/simple-tests.txt b/test/MC/Disassembler/simple-tests.txt index c260945ff71..11c077d8929 100644 --- a/test/MC/Disassembler/simple-tests.txt +++ b/test/MC/Disassembler/simple-tests.txt @@ -38,4 +38,7 @@ 0x0f 0x01 0xc4 # CHECK: swapgs -0x0f 0x01 0xf8 \ No newline at end of file +0x0f 0x01 0xf8 + +# CHECK: rdtscp +0x0f 0x01 0xf9 \ No newline at end of file