OSDN Git Service

[X86] Disable CQTO and CLTQ instructions in the assembly parser outside 64-bit mode.
authorCraig Topper <craig.topper@intel.com>
Mon, 18 Mar 2019 22:06:14 +0000 (22:06 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 18 Mar 2019 22:06:14 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356419 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrExtension.td
test/MC/X86/x86_errors.s

index 0b06b3e..06e605f 100644 (file)
@@ -28,11 +28,11 @@ let hasSideEffects = 0 in {
 
   let Defs = [RAX], Uses = [EAX] in // RAX = signext(EAX)
   def CDQE : RI<0x98, RawFrm, (outs), (ins),
-               "{cltq|cdqe}", []>, Sched<[WriteALU]>;
+               "{cltq|cdqe}", []>, Sched<[WriteALU]>, Requires<[In64BitMode]>;
 
   let Defs = [RAX,RDX], Uses = [RAX] in // RDX:RAX = signext(RAX)
   def CQO  : RI<0x99, RawFrm, (outs), (ins),
-                "{cqto|cqo}", []>, Sched<[WriteALU]>;
+                "{cqto|cqo}", []>, Sched<[WriteALU]>, Requires<[In64BitMode]>;
 }
 
 // Sign/Zero extenders
index d999591..273abd5 100644 (file)
@@ -158,3 +158,9 @@ mov v_ecx(%eax), %ecx
 // 32: 7: error: invalid operand for instruction
 // 64: 7: error: invalid operand for instruction
 addb (%dx), %al
+
+// 32: error: instruction requires: 64-bit mode
+cqto
+
+// 32: error: instruction requires: 64-bit mode
+cltq