]> granicus.if.org Git - llvm/commitdiff
[X86] Classify the AVX512 rounding control operand as X86::OPERAND_ROUNDING_CONTROL...
authorCraig Topper <craig.topper@intel.com>
Mon, 1 Apr 2019 19:08:15 +0000 (19:08 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 1 Apr 2019 19:08:15 +0000 (19:08 +0000)
This should allow llvm-exegesis to intelligently constrain the rounding mode.

The mask in the encoder shouldn't be necessary any more. We used to allow codegen to use 8-11 for rounding mode and the assembler would use 0-3 to mean the same thing so we masked here and in the printer. Codegen now matches the assembler and the printer was updated, but I forgot to update the encoder.

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

lib/Target/X86/MCTargetDesc/X86BaseInfo.h
lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
lib/Target/X86/X86InstrInfo.td

index 5bd4709343d514c39fa99858d29722fd7831129e..7df587273c82eec70bef3afecf01340d33bb0db6 100644 (file)
@@ -62,6 +62,11 @@ namespace X86 {
     IP_HAS_LOCK = 16,
     IP_HAS_NOTRACK = 32
   };
+
+  enum OperandType : unsigned {
+    /// AVX512 embedded rounding control. This should only have values 0-3.
+    OPERAND_ROUNDING_CONTROL = MCOI::OPERAND_FIRST_TARGET,
+  };
 } // end namespace X86;
 
 /// X86II - This namespace holds all of the target specific flags that
index fd95387b0766331aef772c9d9d9b4e5c648900a8..353f52a8c20a3cc9c02444454a39e005b2b85868 100644 (file)
@@ -879,7 +879,8 @@ void X86MCCodeEmitter::EmitVEXOpcodePrefix(uint64_t TSFlags, unsigned &CurByte,
       if (HasEVEX_RC) {
         unsigned RcOperand = NumOps-1;
         assert(RcOperand >= CurOp);
-        EVEX_rc = MI.getOperand(RcOperand).getImm() & 0x3;
+        EVEX_rc = MI.getOperand(RcOperand).getImm();
+        assert(EVEX_rc <= 3 && "Invalid rounding control!");
       }
       EncodeRC = true;
     }
index 67ceceb66982f588c0c3ffb517dc8d72d12db280..f9e729077f3f2b732d076b737b9e6db0602e746e 100644 (file)
@@ -610,7 +610,8 @@ def AVX512RCOperand : AsmOperandClass {
 }
 def AVX512RC : Operand<i32> {
   let PrintMethod = "printRoundingControl";
-  let OperandType = "OPERAND_IMMEDIATE";
+  let OperandNamespace = "X86";
+  let OperandType = "OPERAND_ROUNDING_CONTROL";
   let ParserMatchClass = AVX512RCOperand;
 }