implement the iret suite of instructions properly,
authorChris Lattner <sabre@nondot.org>
Wed, 8 Sep 2010 05:38:31 +0000 (05:38 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 8 Sep 2010 05:38:31 +0000 (05:38 +0000)
fixing rdar://8403974

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113349 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
lib/Target/X86/X86Instr64bit.td
lib/Target/X86/X86InstrInfo.td
test/MC/AsmParser/X86/x86_32-new-encoder.s
test/MC/AsmParser/X86/x86_64-new-encoder.s

index 1b5dccf8e9c4313b0700b163f7fd43b8e3567e41..484ffce8c6d6f4e9f3ca257f880d8bad1aaa2c2c 100644 (file)
@@ -627,6 +627,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
     .Case("repe", "rep")
     .Case("repz", "rep")
     .Case("repnz", "repne")
+    .Case("iret", "iretl")
     .Case("push", Is64Bit ? "pushq" : "pushl")
     .Case("pushf", Is64Bit ? "pushfq" : "pushfl")
     .Case("popf",  Is64Bit ? "popfq"  : "popfl")
index 0884b61425e9eb75e7f467015b3284c1e32ba53e..5f6c68bf882270b491d8dc5459f54699b4d11a7a 100644 (file)
@@ -117,7 +117,8 @@ def ADJCALLSTACKUP64   : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
 }
 
 // Interrupt Instructions
-def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iret{q}", []>;
+def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iretq", []>,
+             Requires<[In64BitMode]>;
 
 //===----------------------------------------------------------------------===//
 //  Call Instructions...
index 58a7e2464c58632464b22802753470ced7e67d16..f50132b21706eb23d8b2f2e893eeaefff4024fff 100644 (file)
@@ -601,8 +601,8 @@ def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3",
               [(int_x86_int (i8 3))]>;
 def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap",
               [(int_x86_int imm:$trap)]>;
-def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", []>, OpSize;
-def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l}", []>;
+def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iretw", []>, OpSize;
+def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l|d}", []>;
 
 // PIC base construction.  This expands to code that looks like this:
 //     call  $next_inst
index e4674b7b98069fe181241cdee449cdf22719d591..e99af15a1da2ddfe2922e4e4d01d4e7df4634485 100644 (file)
@@ -434,3 +434,13 @@ L1:
 // CHECK: jecxz L1
 // CHECK:   encoding: [0xe3,A]
 
+// rdar://8403974
+iret
+// CHECK: iretl
+// CHECK: encoding: [0xcf]
+iretw
+// CHECK: iretw
+// CHECK: encoding: [0x66,0xcf]
+iretl
+// CHECK: iretl
+// CHECK: encoding: [0xcf]
index 5fc29f11f9cd184512452e88adbe4ef7a4693cfa..75a424322b4bcfc74a0d6f7eb87a1efc19b97ca5 100644 (file)
@@ -185,3 +185,20 @@ rep movsl
 // CHECK: encoding: [0xf3]
 // CHECK: movsl
 // CHECK: encoding: [0xa5]
+
+
+// rdar://8403974
+iret
+// CHECK: iretl
+// CHECK: encoding: [0xcf]
+iretw
+// CHECK: iretw
+// CHECK: encoding: [0x66,0xcf]
+iretl
+// CHECK: iretl
+// CHECK: encoding: [0xcf]
+iretq
+// CHECK: iretq
+// CHECK: encoding: [0x48,0xcf]
+
+