[llvm] 19d343d - [X86][APX] Remove prefer-ndd-imm tuning (#203758)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 18:08:59 PDT 2026


Author: Phoebe Wang
Date: 2026-06-15T09:08:54+08:00
New Revision: 19d343debcbc47b1d9b2e2117a599130c33c547c

URL: https://github.com/llvm/llvm-project/commit/19d343debcbc47b1d9b2e2117a599130c33c547c
DIFF: https://github.com/llvm/llvm-project/commit/19d343debcbc47b1d9b2e2117a599130c33c547c.diff

LOG: [X86][APX] Remove prefer-ndd-imm tuning (#203758)

It turns out NDD's immediate variants perform as good as non-NDD's on
real hardware. Verified both on CPU2017 and CPU2026, the geomean is
around 0 w/ and w/o this change. A few items get up and down due to the
side effect of register live range change caused by the NDD form. No
evidence shows this tuning has improvements or degradations even on
single items.

Assisted-by: Claude Sonnet 4.6

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86.td
    llvm/lib/Target/X86/X86InstrArithmetic.td
    llvm/lib/Target/X86/X86InstrCompiler.td
    llvm/lib/Target/X86/X86InstrInfo.cpp
    llvm/lib/Target/X86/X86InstrPredicates.td
    llvm/test/CodeGen/X86/apx/adc.ll
    llvm/test/CodeGen/X86/apx/add.ll
    llvm/test/CodeGen/X86/apx/and.ll
    llvm/test/CodeGen/X86/apx/cmov.ll
    llvm/test/CodeGen/X86/apx/dec.ll
    llvm/test/CodeGen/X86/apx/imul.ll
    llvm/test/CodeGen/X86/apx/inc.ll
    llvm/test/CodeGen/X86/apx/memfold-no-physreg.ll
    llvm/test/CodeGen/X86/apx/mul-i1024.ll
    llvm/test/CodeGen/X86/apx/neg.ll
    llvm/test/CodeGen/X86/apx/not.ll
    llvm/test/CodeGen/X86/apx/or.ll
    llvm/test/CodeGen/X86/apx/rol.ll
    llvm/test/CodeGen/X86/apx/ror.ll
    llvm/test/CodeGen/X86/apx/sar.ll
    llvm/test/CodeGen/X86/apx/sbb.ll
    llvm/test/CodeGen/X86/apx/shl.ll
    llvm/test/CodeGen/X86/apx/shld.ll
    llvm/test/CodeGen/X86/apx/shr.ll
    llvm/test/CodeGen/X86/apx/shrd.ll
    llvm/test/CodeGen/X86/apx/sub.ll
    llvm/test/CodeGen/X86/apx/xor.ll
    llvm/test/CodeGen/X86/cmp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td
index 8cce0589aae41..7551966cb8e15 100644
--- a/llvm/lib/Target/X86/X86.td
+++ b/llvm/lib/Target/X86/X86.td
@@ -789,10 +789,6 @@ def TuningUseGLMDivSqrtCosts
     : SubtargetFeature<"use-glm-div-sqrt-costs", "UseGLMDivSqrtCosts", "true",
         "Use Goldmont specific floating point div/sqrt costs">;
 
-def TuningNDDImm
-    : SubtargetFeature<"prefer-ndd-imm", "HasNDDI",
-          "true", "Prefer NDD immediate variant">;
-
 def TuningNDDMem
     : SubtargetFeature<"prefer-ndd-mem", "HasNDDM",
           "true", "Prefer NDD memory addressing">;

diff  --git a/llvm/lib/Target/X86/X86InstrArithmetic.td b/llvm/lib/Target/X86/X86InstrArithmetic.td
index 3934d449f54e9..c91600525d1eb 100644
--- a/llvm/lib/Target/X86/X86InstrArithmetic.td
+++ b/llvm/lib/Target/X86/X86InstrArithmetic.td
@@ -433,7 +433,7 @@ let isConvertibleToThreeAddress = 1 in {
     def DEC16r : DecOpR_RF<Xi16>, OpSize16;
     def DEC32r : DecOpR_RF<Xi32>, OpSize32;
   }
-  let Predicates = [NoNDDI] in {
+  let Predicates = [NoNDD] in {
     def INC64r : IncOpR_RF<Xi64>;
     def DEC64r : DecOpR_RF<Xi64>;
   }
@@ -445,7 +445,7 @@ let isConvertibleToThreeAddress = 1 in {
     def DEC16r_ND : DecOpR_RF<Xi16, 1>, PD;
     def DEC32r_ND : DecOpR_RF<Xi32, 1>;
   }
-  let Predicates = [HasNDDI, In64BitMode] in {
+  let Predicates = [HasNDD, In64BitMode] in {
     def INC64r_ND : IncOpR_RF<Xi64, 1>;
     def DEC64r_ND : DecOpR_RF<Xi64, 1>;
   }
@@ -639,8 +639,7 @@ multiclass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
                          string mnemonic, Format RegMRM, Format MemMRM,
                          SDNode opnodeflag, SDNode opnode,
                          bit CommutableRR, bit ConvertibleToThreeAddress,
-                         bit ConvertibleToThreeAddressRR,
-                         Predicate prd = HasNDD> {
+                         bit ConvertibleToThreeAddressRR> {
   let isCommutable = CommutableRR,
       isConvertibleToThreeAddress = ConvertibleToThreeAddressRR in {
     let Predicates = [NoNDD] in {
@@ -730,27 +729,23 @@ multiclass ArithBinOp_RF<bits<8> BaseOpc, bits<8> BaseOpc2, bits<8> BaseOpc4,
       def 8ri   : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM>;
       def 16ri  : BinOpRI_RF<0x81, mnemonic, Xi16, opnodeflag, RegMRM>, OpSize16;
       def 32ri  : BinOpRI_RF<0x81, mnemonic, Xi32, opnodeflag, RegMRM>, OpSize32;
-    }
-    let Predicates = [NoNDDI] in {
       def 64ri8 : BinOpRI8_RF<0x83, mnemonic, Xi64, RegMRM>;
       def 64ri32: BinOpRI_RF<0x81, mnemonic, Xi64, opnodeflag, RegMRM>;
     }
     let Predicates = [HasNDD, In64BitMode] in {
       def 16ri8_ND : BinOpRI8_RF<0x83, mnemonic, Xi16, RegMRM, 1>, PD;
       def 32ri8_ND : BinOpRI8_RF<0x83, mnemonic, Xi32, RegMRM, 1>;
+      def 64ri8_ND : BinOpRI8_RF<0x83, mnemonic, Xi64, RegMRM, 1>;
       def 8ri_ND   : BinOpRI_RF<0x80, mnemonic, Xi8 , opnodeflag, RegMRM, 1>;
       def 16ri_ND  : BinOpRI_RF<0x81, mnemonic, Xi16, opnodeflag, RegMRM, 1>, PD;
       def 32ri_ND  : BinOpRI_RF<0x81, mnemonic, Xi32, opnodeflag, RegMRM, 1>;
+      def 64ri32_ND: BinOpRI_RF<0x81, mnemonic, Xi64, opnodeflag, RegMRM, 1>;
       def 16ri8_NF_ND : BinOpRI8_R<0x83, mnemonic, Xi16, RegMRM, 1>, EVEX_NF, PD;
       def 32ri8_NF_ND : BinOpRI8_R<0x83, mnemonic, Xi32, RegMRM, 1>, EVEX_NF;
+      def 64ri8_NF_ND : BinOpRI8_R<0x83, mnemonic, Xi64, RegMRM, 1>, EVEX_NF;
       def 8ri_NF_ND  : BinOpRI_R<0x80, mnemonic, Xi8, RegMRM, 1>, EVEX_NF;
       def 16ri_NF_ND : BinOpRI_R<0x81, mnemonic, Xi16, RegMRM, 1>, EVEX_NF, PD;
       def 32ri_NF_ND : BinOpRI_R<0x81, mnemonic, Xi32, RegMRM, 1>, EVEX_NF;
-    }
-    let Predicates = [prd, In64BitMode] in {
-      def 64ri8_ND : BinOpRI8_RF<0x83, mnemonic, Xi64, RegMRM, 1>;
-      def 64ri32_ND: BinOpRI_RF<0x81, mnemonic, Xi64, opnodeflag, RegMRM, 1>;
-      def 64ri8_NF_ND : BinOpRI8_R<0x83, mnemonic, Xi64, RegMRM, 1>, EVEX_NF;
       def 64ri32_NF_ND : BinOpRI_R<0x81, mnemonic, Xi64, RegMRM, 1>, EVEX_NF;
     }
     let Predicates = [In64BitMode] in {
@@ -1103,10 +1098,10 @@ defm OR  : ArithBinOp_RF<0x09, 0x0B, 0x0D, "or", MRM1r, MRM1m,
 defm XOR : ArithBinOp_RF<0x31, 0x33, 0x35, "xor", MRM6r, MRM6m,
                          X86xor_flag, xor, 1, 0, 0>;
 defm ADD : ArithBinOp_RF<0x01, 0x03, 0x05, "add", MRM0r, MRM0m,
-                         X86add_flag, add, 1, 1, 1, HasNDDI>;
+                         X86add_flag, add, 1, 1, 1>;
 let isCompare = 1 in {
   defm SUB : ArithBinOp_RF<0x29, 0x2B, 0x2D, "sub", MRM5r, MRM5m,
-                           X86sub_flag, sub, 0, 1, 0, HasNDDI>;
+                           X86sub_flag, sub, 0, 1, 0>;
 }
 
 // Version of XOR8rr_NOREX that use GR8_NOREX. This is used by the handling of
@@ -1166,8 +1161,7 @@ def : Pat<(store (X86adc_flag GR64:$src, (loadi64 addr:$dst), EFLAGS),
           (ADC64mr addr:$dst, GR64:$src)>;
 
 // Patterns for basic arithmetic ops with relocImm for the immediate field.
-multiclass ArithBinOp_RF_relocImm_Pats<SDNode OpNodeFlag, SDNode OpNode,
-                                       Predicate prd=HasNDD> {
+multiclass ArithBinOp_RF_relocImm_Pats<SDNode OpNodeFlag, SDNode OpNode> {
   let Predicates = [NoNDD] in {
     def : Pat<(OpNodeFlag GR8:$src1, relocImm8_su:$src2),
               (!cast<Instruction>(NAME#"8ri") GR8:$src1, relocImm8_su:$src2)>;
@@ -1175,6 +1169,8 @@ multiclass ArithBinOp_RF_relocImm_Pats<SDNode OpNodeFlag, SDNode OpNode,
               (!cast<Instruction>(NAME#"16ri") GR16:$src1, relocImm16_su:$src2)>;
     def : Pat<(OpNodeFlag GR32:$src1, relocImm32_su:$src2),
               (!cast<Instruction>(NAME#"32ri") GR32:$src1, relocImm32_su:$src2)>;
+    def : Pat<(OpNodeFlag GR64:$src1, i64relocImmSExt32_su:$src2),
+              (!cast<Instruction>(NAME#"64ri32") GR64:$src1, i64relocImmSExt32_su:$src2)>;
 
     def : Pat<(store (OpNode (load addr:$dst), relocImm8_su:$src), addr:$dst),
               (!cast<Instruction>(NAME#"8mi") addr:$dst, relocImm8_su:$src)>;
@@ -1192,6 +1188,8 @@ multiclass ArithBinOp_RF_relocImm_Pats<SDNode OpNodeFlag, SDNode OpNode,
               (!cast<Instruction>(NAME#"16ri_ND") GR16:$src1, relocImm16_su:$src2)>;
     def : Pat<(OpNodeFlag GR32:$src1, relocImm32_su:$src2),
               (!cast<Instruction>(NAME#"32ri_ND") GR32:$src1, relocImm32_su:$src2)>;
+    def : Pat<(OpNodeFlag GR64:$src1, i64relocImmSExt32_su:$src2),
+              (!cast<Instruction>(NAME#"64ri32_ND") GR64:$src1, i64relocImmSExt32_su:$src2)>;
 
     def : Pat<(OpNode (load ndd_addr:$dst), relocImm8_su:$src),
               (!cast<Instruction>(NAME#"8mi_ND") ndd_addr:$dst, relocImm8_su:$src)>;
@@ -1202,14 +1200,6 @@ multiclass ArithBinOp_RF_relocImm_Pats<SDNode OpNodeFlag, SDNode OpNode,
     def : Pat<(OpNode (load ndd_addr:$dst), i64relocImmSExt32_su:$src),
               (!cast<Instruction>(NAME#"64mi32_ND") ndd_addr:$dst, i64relocImmSExt32_su:$src)>;
   }
-
-  let Predicates = [NoNDDI] in
-    def : Pat<(OpNodeFlag GR64:$src1, i64relocImmSExt32_su:$src2),
-              (!cast<Instruction>(NAME#"64ri32") GR64:$src1, i64relocImmSExt32_su:$src2)>;
-
-  let Predicates = [prd] in
-    def : Pat<(OpNodeFlag GR64:$src1, i64relocImmSExt32_su:$src2),
-              (!cast<Instruction>(NAME#"64ri32_ND") GR64:$src1, i64relocImmSExt32_su:$src2)>;
 }
 
 multiclass ArithBinOp_RFF_relocImm_Pats<SDNode OpNodeFlag> {
@@ -1276,8 +1266,8 @@ multiclass ArithBinOp_F_relocImm_Pats<SDNode OpNodeFlag> {
 defm AND : ArithBinOp_RF_relocImm_Pats<X86and_flag, and>;
 defm OR  : ArithBinOp_RF_relocImm_Pats<X86or_flag, or>;
 defm XOR : ArithBinOp_RF_relocImm_Pats<X86xor_flag, xor>;
-defm ADD : ArithBinOp_RF_relocImm_Pats<X86add_flag, add, HasNDDI>;
-defm SUB : ArithBinOp_RF_relocImm_Pats<X86sub_flag, sub, HasNDDI>;
+defm ADD : ArithBinOp_RF_relocImm_Pats<X86add_flag, add>;
+defm SUB : ArithBinOp_RF_relocImm_Pats<X86sub_flag, sub>;
 
 defm ADC : ArithBinOp_RFF_relocImm_Pats<X86adc_flag>;
 defm SBB : ArithBinOp_RFF_relocImm_Pats<X86sbb_flag>;

diff  --git a/llvm/lib/Target/X86/X86InstrCompiler.td b/llvm/lib/Target/X86/X86InstrCompiler.td
index c7ea2985d1353..35dfdf2d0067c 100644
--- a/llvm/lib/Target/X86/X86InstrCompiler.td
+++ b/llvm/lib/Target/X86/X86InstrCompiler.td
@@ -1614,15 +1614,13 @@ let Predicates = [NoNDD] in {
             (SUB16ri GR16:$src1, -128)>;
   def : Pat<(add GR32:$src1, 128),
             (SUB32ri GR32:$src1, -128)>;
+  def : Pat<(add GR64:$src1, 128),
+            (SUB64ri32 GR64:$src1, -128)>;
 
   def : Pat<(X86add_flag_nocf GR16:$src1, 128),
             (SUB16ri GR16:$src1, -128)>;
   def : Pat<(X86add_flag_nocf GR32:$src1, 128),
             (SUB32ri GR32:$src1, -128)>;
-}
-let Predicates = [NoNDDI] in {
-  def : Pat<(add GR64:$src1, 128),
-            (SUB64ri32 GR64:$src1, -128)>;
   def : Pat<(X86add_flag_nocf GR64:$src1, 128),
             (SUB64ri32 GR64:$src1, -128)>;
 }
@@ -1631,15 +1629,13 @@ let Predicates = [HasNDD] in {
             (SUB16ri_ND GR16:$src1, -128)>;
   def : Pat<(add GR32:$src1, 128),
             (SUB32ri_ND GR32:$src1, -128)>;
+  def : Pat<(add GR64:$src1, 128),
+            (SUB64ri32_ND GR64:$src1, -128)>;
 
   def : Pat<(X86add_flag_nocf GR16:$src1, 128),
             (SUB16ri_ND GR16:$src1, -128)>;
   def : Pat<(X86add_flag_nocf GR32:$src1, 128),
             (SUB32ri_ND GR32:$src1, -128)>;
-}
-let Predicates = [HasNDDI] in {
-  def : Pat<(add GR64:$src1, 128),
-            (SUB64ri32_ND GR64:$src1, -128)>;
   def : Pat<(X86add_flag_nocf GR64:$src1, 128),
             (SUB64ri32_ND GR64:$src1, -128)>;
 }
@@ -1666,7 +1662,7 @@ let Predicates = [NoNDD] in {
   def : Pat<(X86add_flag_nocf GR64:$src1, 0x0000000080000000),
             (SUB64ri32 GR64:$src1, 0xffffffff80000000)>;
 }
-let Predicates = [HasNDDI] in {
+let Predicates = [HasNDD] in {
   def : Pat<(add GR64:$src1, 0x0000000080000000),
             (SUB64ri32_ND GR64:$src1, 0xffffffff80000000)>;
   def : Pat<(X86add_flag_nocf GR64:$src1, 0x0000000080000000),
@@ -2107,7 +2103,7 @@ def : Pat<(X86btc GR64:$src1, GR64:$src2), (BTC64rr GR64:$src1, GR64:$src2)>;
 // EFLAGS-defining Patterns
 //===----------------------------------------------------------------------===//
 
-multiclass EFLAGSDefiningPats<string suffix, Predicate PredNDD, Predicate PredNDDI, bit ndd> {
+multiclass EFLAGSDefiningPats<string suffix, Predicate PredNDD, bit ndd> {
   let Predicates = [PredNDD] in {
     // add reg, reg
     def : Pat<(add GR8 :$src1, GR8 :$src2), (!cast<Instruction>(ADD8rr#suffix) GR8 :$src1, GR8 :$src2)>;
@@ -2250,9 +2246,7 @@ multiclass EFLAGSDefiningPats<string suffix, Predicate PredNDD, Predicate PredND
               (!cast<Instruction>(AND32ri#suffix) GR32:$src1, imm:$src2)>;
     def : Pat<(and GR64:$src1, i64immSExt32:$src2),
               (!cast<Instruction>(AND64ri32#suffix) GR64:$src1, i64immSExt32:$src2)>;
-  }
 
-  let Predicates = [PredNDDI] in {
     def : Pat<(add GR64:$src1, i64immSExt32:$src2), (!cast<Instruction>(ADD64ri32#suffix) GR64:$src1, i64immSExt32:$src2)>;
     def : Pat<(sub GR64:$src1, i64immSExt32:$src2),
               (!cast<Instruction>(SUB64ri32#suffix) GR64:$src1, i64immSExt32:$src2)>;
@@ -2264,28 +2258,25 @@ multiclass EFLAGSDefiningPats<string suffix, Predicate PredNDD, Predicate PredND
     def : Pat<(add_like GR8:$src, 1),   (!cast<Instruction>(INC8r#suffix) GR8:$src)>;
     def : Pat<(add_like GR16:$src, 1),  (!cast<Instruction>(INC16r#suffix) GR16:$src)>;
     def : Pat<(add_like GR32:$src, 1),  (!cast<Instruction>(INC32r#suffix) GR32:$src)>;
+    def : Pat<(add_like GR64:$src, 1),  (!cast<Instruction>(INC64r#suffix) GR64:$src)>;
     def : Pat<(add GR8:$src, -1),  (!cast<Instruction>(DEC8r#suffix) GR8:$src)>;
     def : Pat<(add GR16:$src, -1), (!cast<Instruction>(DEC16r#suffix) GR16:$src)>;
     def : Pat<(add GR32:$src, -1), (!cast<Instruction>(DEC32r#suffix) GR32:$src)>;
+    def : Pat<(add GR64:$src, -1), (!cast<Instruction>(DEC64r#suffix) GR64:$src)>;
 
     def : Pat<(X86add_flag_nocf GR8:$src, -1),  (!cast<Instruction>(DEC8r#suffix) GR8:$src)>;
     def : Pat<(X86add_flag_nocf GR16:$src, -1), (!cast<Instruction>(DEC16r#suffix) GR16:$src)>;
     def : Pat<(X86add_flag_nocf GR32:$src, -1), (!cast<Instruction>(DEC32r#suffix) GR32:$src)>;
+    def : Pat<(X86add_flag_nocf GR64:$src, -1), (!cast<Instruction>(DEC64r#suffix) GR64:$src)>;
     def : Pat<(X86sub_flag_nocf GR8:$src, -1),  (!cast<Instruction>(INC8r#suffix) GR8:$src)>;
     def : Pat<(X86sub_flag_nocf GR16:$src, -1), (!cast<Instruction>(INC16r#suffix) GR16:$src)>;
     def : Pat<(X86sub_flag_nocf GR32:$src, -1), (!cast<Instruction>(INC32r#suffix) GR32:$src)>;
-  }
-
-  let Predicates = [UseIncDec, PredNDDI] in {
-    def : Pat<(add_like GR64:$src, 1),  (!cast<Instruction>(INC64r#suffix) GR64:$src)>;
-    def : Pat<(add GR64:$src, -1), (!cast<Instruction>(DEC64r#suffix) GR64:$src)>;
-    def : Pat<(X86add_flag_nocf GR64:$src, -1), (!cast<Instruction>(DEC64r#suffix) GR64:$src)>;
     def : Pat<(X86sub_flag_nocf GR64:$src, -1), (!cast<Instruction>(INC64r#suffix) GR64:$src)>;
   }
 }
 
-defm : EFLAGSDefiningPats<"", NoNDD, NoNDDI, 0>;
-defm : EFLAGSDefiningPats<"_ND", HasNDD, HasNDDI, 1>;
+defm : EFLAGSDefiningPats<"", NoNDD, 0>;
+defm : EFLAGSDefiningPats<"_ND", HasNDD, 1>;
 
 let Predicates = [HasZU] in {
   // zext (mul reg/mem, imm) -> imulzu

diff  --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 15d2e10aa0f08..d4162414b3b40 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -5699,7 +5699,7 @@ static bool canConvert2Copy(unsigned Opc) {
 
 /// Convert an ALUrr opcode to corresponding ALUri opcode. Such as
 ///     ADD32rr  ==>  ADD32ri
-static unsigned convertALUrr2ALUri(unsigned Opc, bool HasNDDI) {
+static unsigned convertALUrr2ALUri(unsigned Opc) {
   switch (Opc) {
   default:
     return 0;
@@ -5750,9 +5750,9 @@ static unsigned convertALUrr2ALUri(unsigned Opc, bool HasNDDI) {
     FROM_TO(CCMP32rr, CCMP32ri)
 #undef FROM_TO
   case X86::ADD64rr_ND:
-    return HasNDDI ? X86::ADD64ri32_ND : 0;
+    return X86::ADD64ri32_ND;
   case X86::SUB64rr_ND:
-    return HasNDDI ? X86::SUB64ri32_ND : 0;
+    return X86::SUB64ri32_ND;
   }
 }
 
@@ -5839,7 +5839,7 @@ bool X86InstrInfo::foldImmediateImpl(MachineInstr &UseMI, MachineInstr *DefMI,
     else
       return false;
   } else
-    NewOpc = convertALUrr2ALUri(Opc, Subtarget.hasNDDI());
+    NewOpc = convertALUrr2ALUri(Opc);
 
   if (!NewOpc)
     return false;

diff  --git a/llvm/lib/Target/X86/X86InstrPredicates.td b/llvm/lib/Target/X86/X86InstrPredicates.td
index 352de4141ce71..afca2e6eafd2c 100644
--- a/llvm/lib/Target/X86/X86InstrPredicates.td
+++ b/llvm/lib/Target/X86/X86InstrPredicates.td
@@ -50,8 +50,6 @@ def PreferLegacySetCC  : Predicate<"!Subtarget->hasZU() || "
                                    "Subtarget->preferLegacySetCC()">;
 def PreferNoLegacySetCC : Predicate<"Subtarget->hasZU() && "
                                     "!Subtarget->preferLegacySetCC()">;
-def HasNDDI      : Predicate<"Subtarget->hasNDD() && Subtarget->hasNDDI()">;
-def NoNDDI       : Predicate<"!Subtarget->hasNDD() || !Subtarget->hasNDDI()">;
 def HasCF        : Predicate<"Subtarget->hasCF()">;
 def HasJMPABS    : Predicate<"Subtarget->hasJMPABS()">;
 def HasCMOV      : Predicate<"Subtarget->canUseCMOV()">;

diff  --git a/llvm/test/CodeGen/X86/apx/adc.ll b/llvm/test/CodeGen/X86/apx/adc.ll
index 863fe8b5a518a..f524ffce89f61 100644
--- a/llvm/test/CodeGen/X86/apx/adc.ll
+++ b/llvm/test/CodeGen/X86/apx/adc.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @adc8rr(i8 %a, i8 %b, i8 %x, i8 %y) nounwind {
 ; CHECK-LABEL: adc8rr:

diff  --git a/llvm/test/CodeGen/X86/apx/add.ll b/llvm/test/CodeGen/X86/apx/add.ll
index 0cbbbdfbb8715..d7c5635b617c1 100644
--- a/llvm/test/CodeGen/X86/apx/add.ll
+++ b/llvm/test/CodeGen/X86/apx/add.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM,BOTH
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 
@@ -74,13 +72,6 @@ define i8 @add8rm(i8 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    addb (%rsi), %al # encoding: [0x02,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x02,0x3e]
@@ -106,13 +97,6 @@ define i16 @add16rm(i16 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    addw (%rsi), %ax # encoding: [0x66,0x03,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x03,0x3e]
@@ -137,12 +121,6 @@ define i32 @add32rm(i32 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    addl (%rsi), %eax # encoding: [0x03,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    addl (%rsi), %eax # encoding: [0x03,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x03,0x3e]
@@ -166,12 +144,6 @@ define i64 @add64rm(i64 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    addq (%rsi), %rax # encoding: [0x48,0x03,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    addq (%rsi), %rax # encoding: [0x48,0x03,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x03,0x3e]
@@ -303,13 +275,6 @@ define i8 @add8mr(ptr %a, i8 noundef %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add8mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    addb (%rdi), %al # encoding: [0x02,0x07]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add8mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addb (%rdi), %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x02,0x37]
@@ -335,13 +300,6 @@ define i16 @add16mr(ptr %a, i16 noundef %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add16mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    addw (%rdi), %ax # encoding: [0x66,0x03,0x07]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add16mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw (%rdi), %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x03,0x37]
@@ -366,12 +324,6 @@ define i32 @add32mr(ptr %a, i32 noundef %b) {
 ; NDD-NEXT:    addl (%rdi), %eax # encoding: [0x03,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add32mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    addl (%rdi), %eax # encoding: [0x03,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add32mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl (%rdi), %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x03,0x37]
@@ -395,12 +347,6 @@ define i64 @add64mr(ptr %a, i64 noundef %b) {
 ; NDD-NEXT:    addq (%rdi), %rax # encoding: [0x48,0x03,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add64mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rsi, %rax # encoding: [0x48,0x89,0xf0]
-; IMMONLY-NEXT:    addq (%rdi), %rax # encoding: [0x48,0x03,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add64mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addq (%rdi), %rsi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x03,0x37]
@@ -424,12 +370,6 @@ define i16 @add16mi8(ptr %a) {
 ; NDD-NEXT:    addw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add16mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    addw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add16mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x07,0x7b]
@@ -453,12 +393,6 @@ define i32 @add32mi8(ptr %a) {
 ; NDD-NEXT:    addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add32mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    addl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add32mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x07,0x7b]
@@ -479,30 +413,18 @@ define i64 @add64mi8(ptr %a) {
 ; NDD-LABEL: add64mi8:
 ; NDD:       # %bb.0: # %entry
 ; NDD-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NDD-NEXT:    addq $123, %rax # encoding: [0x48,0x83,0xc0,0x7b]
+; NDD-NEXT:    addq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xc0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add64mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    addq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xc0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: add64mi8:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; MEMONLY-NEXT:    addq $123, %rax # encoding: [0x48,0x83,0xc0,0x7b]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
-;
-; BOTH-LABEL: add64mi8:
-; BOTH:       # %bb.0: # %entry
-; BOTH-NEXT:    addq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x07,0x7b]
-; BOTH-NEXT:    retq # encoding: [0xc3]
+; MEM-LABEL: add64mi8:
+; MEM:       # %bb.0: # %entry
+; MEM-NEXT:    addq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x07,0x7b]
+; MEM-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: add64mi8:
 ; NF:       # %bb.0: # %entry
 ; NF-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NF-NEXT:    addq $123, %rax # encoding: [0x48,0x83,0xc0,0x7b]
+; NF-NEXT:    addq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xc0,0x7b]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i64, ptr %a
@@ -517,12 +439,6 @@ define i8 @add8mi(ptr %a) {
 ; NDD-NEXT:    addb $123, %al # EVEX TO LEGACY Compression encoding: [0x04,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add8mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    addb $123, %al # EVEX TO LEGACY Compression encoding: [0x04,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add8mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addb $123, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x80,0x07,0x7b]
@@ -547,13 +463,6 @@ define i16 @add16mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x4D2
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add16mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    addw $1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x05,0xd2,0x04]
-; IMMONLY-NEXT:    # imm = 0x4D2
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add16mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x07,0xd2,0x04]
@@ -580,13 +489,6 @@ define i32 @add32mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add32mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    addl $123456, %eax # EVEX TO LEGACY Compression encoding: [0x05,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add32mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl $123456, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x07,0x40,0xe2,0x01,0x00]
@@ -609,17 +511,10 @@ define i64 @add64mi(ptr %a) {
 ; NDD-LABEL: add64mi:
 ; NDD:       # %bb.0: # %entry
 ; NDD-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NDD-NEXT:    addq $123456, %rax # encoding: [0x48,0x05,0x40,0xe2,0x01,0x00]
+; NDD-NEXT:    addq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,0x40,0xe2,0x01,0x00]
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: add64mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    addq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: add64mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addq $123456, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x07,0x40,0xe2,0x01,0x00]
@@ -629,7 +524,7 @@ define i64 @add64mi(ptr %a) {
 ; NF-LABEL: add64mi:
 ; NF:       # %bb.0: # %entry
 ; NF-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NF-NEXT:    addq $123456, %rax # encoding: [0x48,0x05,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    addq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
@@ -737,15 +632,6 @@ define i8 @addflag8rm(i8 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: addflag8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    addb (%rsi), %dil # encoding: [0x40,0x02,0x3e]
-; IMMONLY-NEXT:    movzbl %dil, %eax # encoding: [0x40,0x0f,0xb6,0xc7]
-; IMMONLY-NEXT:    movl $255, %ecx # encoding: [0xb9,0xff,0x00,0x00,0x00]
-; IMMONLY-NEXT:    cmovbl %ecx, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x42,0xc1]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: addflag8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x02,0x3e]
@@ -779,15 +665,6 @@ define i16 @addflag16rm(i16 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: addflag16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    addw (%rsi), %di # encoding: [0x66,0x03,0x3e]
-; IMMONLY-NEXT:    movl $65535, %eax # encoding: [0xb8,0xff,0xff,0x00,0x00]
-; IMMONLY-NEXT:    # imm = 0xFFFF
-; IMMONLY-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: addflag16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x03,0x3e]
@@ -819,13 +696,6 @@ define i32 @addflag32rm(i32 noundef %a, ptr %b) {
 ; NDD-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: addflag32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    addl (%rsi), %edi # encoding: [0x03,0x3e]
-; IMMONLY-NEXT:    movl $-1, %eax # encoding: [0xb8,0xff,0xff,0xff,0xff]
-; IMMONLY-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: addflag32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x03,0x3e]
@@ -853,13 +723,6 @@ define i64 @addflag64rm(i64 noundef %a, ptr %b) {
 ; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: addflag64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    addq (%rsi), %rdi # encoding: [0x48,0x03,0x3e]
-; IMMONLY-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; IMMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: addflag64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x03,0x3e]
@@ -922,32 +785,18 @@ entry:
 }
 
 define i64 @addflag64ri8(i64 noundef %a) {
-; NDD-LABEL: addflag64ri8:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    addq $123, %rdi # encoding: [0x48,0x83,0xc7,0x7b]
-; NDD-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: addflag64ri8:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    addq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xc7,0x7b]
-; IMM-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
-; IMM-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: addflag64ri8:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    addq $123, %rdi # encoding: [0x48,0x83,0xc7,0x7b]
-; MEMONLY-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; MEMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: addflag64ri8:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    addq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xc7,0x7b]
+; CHECK-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
+; CHECK-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: addflag64ri8:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    addq $123, %rdi # encoding: [0x48,0x83,0xc7,0x7b]
-; NF-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; NF-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
+; NF-NEXT:    addq $123, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xc7,0x7b]
+; NF-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
+; NF-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
     %add = call i64 @llvm.uadd.sat.i64(i64 %a, i64 123)
@@ -1024,36 +873,20 @@ entry:
 }
 
 define i64 @addflag64ri(i64 noundef %a) {
-; NDD-LABEL: addflag64ri:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    addq $123456, %rdi # encoding: [0x48,0x81,0xc7,0x40,0xe2,0x01,0x00]
-; NDD-NEXT:    # imm = 0x1E240
-; NDD-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: addflag64ri:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    addq $123456, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xc7,0x40,0xe2,0x01,0x00]
-; IMM-NEXT:    # imm = 0x1E240
-; IMM-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
-; IMM-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: addflag64ri:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    addq $123456, %rdi # encoding: [0x48,0x81,0xc7,0x40,0xe2,0x01,0x00]
-; MEMONLY-NEXT:    # imm = 0x1E240
-; MEMONLY-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; MEMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: addflag64ri:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    addq $123456, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xc7,0x40,0xe2,0x01,0x00]
+; CHECK-NEXT:    # imm = 0x1E240
+; CHECK-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
+; CHECK-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: addflag64ri:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    addq $123456, %rdi # encoding: [0x48,0x81,0xc7,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    addq $123456, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xc7,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
-; NF-NEXT:    movq $-1, %rax # encoding: [0x48,0xc7,0xc0,0xff,0xff,0xff,0xff]
-; NF-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
+; NF-NEXT:    movq $-1, %rcx # encoding: [0x48,0xc7,0xc1,0xff,0xff,0xff,0xff]
+; NF-NEXT:    cmovbq %rcx, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x42,0xc1]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
     %add = call i64 @llvm.uadd.sat.i64(i64 %a, i64 123456)
@@ -1063,42 +896,22 @@ entry:
 @val = external dso_local global i16, align 4
 
 define i1 @add64ri_reloc(i16 %k) {
-; NDD-LABEL: add64ri_reloc:
-; NDD:       # %bb.0:
-; NDD-NEXT:    # kill: def $edi killed $edi def $rdi
-; NDD-NEXT:    movswq %di, %rax # encoding: [0x48,0x0f,0xbf,0xc7]
-; NDD-NEXT:    addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
-; NDD-NEXT:    addq $val, %rax # encoding: [0x48,0x05,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
-; NDD-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: add64ri_reloc:
-; IMM:       # %bb.0:
-; IMM-NEXT:    # kill: def $edi killed $edi def $rdi
-; IMM-NEXT:    movswq %di, %rax # encoding: [0x48,0x0f,0xbf,0xc7]
-; IMM-NEXT:    addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
-; IMM-NEXT:    addq $val, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
-; IMM-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: add64ri_reloc:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    # kill: def $edi killed $edi def $rdi
-; MEMONLY-NEXT:    movswq %di, %rax # encoding: [0x48,0x0f,0xbf,0xc7]
-; MEMONLY-NEXT:    addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
-; MEMONLY-NEXT:    addq $val, %rax # encoding: [0x48,0x05,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
-; MEMONLY-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: add64ri_reloc:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT:    movswq %di, %rax # encoding: [0x48,0x0f,0xbf,0xc7]
+; CHECK-NEXT:    addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
+; CHECK-NEXT:    addq $val, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
+; CHECK-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: add64ri_reloc:
 ; NF:       # %bb.0:
 ; NF-NEXT:    # kill: def $edi killed $edi def $rdi
 ; NF-NEXT:    movswq %di, %rax # encoding: [0x48,0x0f,0xbf,0xc7]
 ; NF-NEXT:    addq %rax, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xc0]
-; NF-NEXT:    addq $val, %rax # encoding: [0x48,0x05,A,A,A,A]
+; NF-NEXT:    addq $val, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x05,A,A,A,A]
 ; NF-NEXT:    # fixup A - offset: 2, value: val, kind: reloc_signed_4byte
 ; NF-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
 ; NF-NEXT:    retq # encoding: [0xc3]
@@ -1315,71 +1128,6 @@ define i32 @two_address_no_subreg(i32 %arg0, ptr %arg1, i1 %arg2) nounwind {
 ; NDD-NEXT:    popq %rbp # encoding: [0x5d]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: two_address_no_subreg:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    pushq %rbp # encoding: [0x55]
-; IMMONLY-NEXT:    pushq %r15 # encoding: [0x41,0x57]
-; IMMONLY-NEXT:    pushq %r14 # encoding: [0x41,0x56]
-; IMMONLY-NEXT:    pushq %r13 # encoding: [0x41,0x55]
-; IMMONLY-NEXT:    pushq %r12 # encoding: [0x41,0x54]
-; IMMONLY-NEXT:    pushq %rbx # encoding: [0x53]
-; IMMONLY-NEXT:    pushq %rax # encoding: [0x50]
-; IMMONLY-NEXT:    movl %edx, %ebp # encoding: [0x89,0xd5]
-; IMMONLY-NEXT:    movq %rsi, %r14 # encoding: [0x49,0x89,0xf6]
-; IMMONLY-NEXT:    movl %edi, %ebx # encoding: [0x89,0xfb]
-; IMMONLY-NEXT:    movslq %edi, %rax # encoding: [0x48,0x63,0xc7]
-; IMMONLY-NEXT:    imulq $715827883, %rax, %r13 # encoding: [0x4c,0x69,0xe8,0xab,0xaa,0xaa,0x2a]
-; IMMONLY-NEXT:    # imm = 0x2AAAAAAB
-; IMMONLY-NEXT:    shrq $63, %r13, %rax # encoding: [0x62,0xd4,0xfc,0x18,0xc1,0xed,0x3f]
-; IMMONLY-NEXT:    movq %rax, (%rsp) # 8-byte Spill
-; IMMONLY-NEXT:    # encoding: [0x48,0x89,0x04,0x24]
-; IMMONLY-NEXT:    shrq $32, %r13 # EVEX TO LEGACY Compression encoding: [0x49,0xc1,0xed,0x20]
-; IMMONLY-NEXT:    xorl %r15d, %r15d # encoding: [0x45,0x31,0xff]
-; IMMONLY-NEXT:    movq %rsi, %rdi # encoding: [0x48,0x89,0xf7]
-; IMMONLY-NEXT:    callq *%r15 # encoding: [0x41,0xff,0xd7]
-; IMMONLY-NEXT:    movq %r14, %rdi # encoding: [0x4c,0x89,0xf7]
-; IMMONLY-NEXT:    callq *%r15 # encoding: [0x41,0xff,0xd7]
-; IMMONLY-NEXT:    movl $1, %r12d # encoding: [0x41,0xbc,0x01,0x00,0x00,0x00]
-; IMMONLY-NEXT:    testb $1, %bpl # encoding: [0x40,0xf6,0xc5,0x01]
-; IMMONLY-NEXT:    jne .LBB50_2 # encoding: [0x75,A]
-; IMMONLY-NEXT:    # fixup A - offset: 1, value: .LBB50_2, kind: FK_PCRel_1
-; IMMONLY-NEXT:  # %bb.1: # %bb2
-; IMMONLY-NEXT:    xorl %r12d, %r12d # encoding: [0x45,0x31,0xe4]
-; IMMONLY-NEXT:  .LBB50_2: # %bb1
-; IMMONLY-NEXT:    movl %r13d, %esi # encoding: [0x44,0x89,0xee]
-; IMMONLY-NEXT:    addl (%rsp), %esi # 4-byte Folded Reload
-; IMMONLY-NEXT:    # encoding: [0x03,0x34,0x24]
-; IMMONLY-NEXT:    imull %ebx, %ebx, %r13d # encoding: [0x62,0xf4,0x14,0x18,0xaf,0xdb]
-; IMMONLY-NEXT:    testb $1, %bpl # encoding: [0x40,0xf6,0xc5,0x01]
-; IMMONLY-NEXT:    jne .LBB50_4 # encoding: [0x75,A]
-; IMMONLY-NEXT:    # fixup A - offset: 1, value: .LBB50_4, kind: FK_PCRel_1
-; IMMONLY-NEXT:  # %bb.3: # %bb4
-; IMMONLY-NEXT:    xorl %ebp, %ebp # encoding: [0x31,0xed]
-; IMMONLY-NEXT:    movq %r14, %rdi # encoding: [0x4c,0x89,0xf7]
-; IMMONLY-NEXT:    movl %esi, %r14d # encoding: [0x41,0x89,0xf6]
-; IMMONLY-NEXT:    callq *%rbp # encoding: [0xff,0xd5]
-; IMMONLY-NEXT:    incl %r12d, %r15d # encoding: [0x62,0xd4,0x04,0x18,0xff,0xc4]
-; IMMONLY-NEXT:    xorl %edi, %edi # encoding: [0x31,0xff]
-; IMMONLY-NEXT:    callq *%rbp # encoding: [0xff,0xd5]
-; IMMONLY-NEXT:    movl %r14d, %esi # encoding: [0x44,0x89,0xf6]
-; IMMONLY-NEXT:  .LBB50_4: # %bb3
-; IMMONLY-NEXT:    orl %r13d, %esi # EVEX TO LEGACY Compression encoding: [0x44,0x09,0xee]
-; IMMONLY-NEXT:    orl %r15d, %esi # EVEX TO LEGACY Compression encoding: [0x44,0x09,0xfe]
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    movl %ebx, %edi # encoding: [0x89,0xdf]
-; IMMONLY-NEXT:    xorl %edx, %edx # encoding: [0x31,0xd2]
-; IMMONLY-NEXT:    xorl %ecx, %ecx # encoding: [0x31,0xc9]
-; IMMONLY-NEXT:    callq *%rax # encoding: [0xff,0xd0]
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    addq $8, %rsp # encoding: [0x48,0x83,0xc4,0x08]
-; IMMONLY-NEXT:    popq %rbx # encoding: [0x5b]
-; IMMONLY-NEXT:    popq %r12 # encoding: [0x41,0x5c]
-; IMMONLY-NEXT:    popq %r13 # encoding: [0x41,0x5d]
-; IMMONLY-NEXT:    popq %r14 # encoding: [0x41,0x5e]
-; IMMONLY-NEXT:    popq %r15 # encoding: [0x41,0x5f]
-; IMMONLY-NEXT:    popq %rbp # encoding: [0x5d]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: two_address_no_subreg:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    pushq %rbp # encoding: [0x55]

diff  --git a/llvm/test/CodeGen/X86/apx/and.ll b/llvm/test/CodeGen/X86/apx/and.ll
index 9e9601afadb9a..e3b8bd6179bcc 100644
--- a/llvm/test/CodeGen/X86/apx/and.ll
+++ b/llvm/test/CodeGen/X86/apx/and.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 
@@ -78,13 +76,6 @@ define i8 @and8rm(i8 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    andb (%rsi), %al # encoding: [0x22,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x22,0x3e]
@@ -110,13 +101,6 @@ define i16 @and16rm(i16 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    andw (%rsi), %ax # encoding: [0x66,0x23,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x23,0x3e]
@@ -141,12 +125,6 @@ define i32 @and32rm(i32 noundef %a, ptr %b) {
 ; NDD-NEXT:    andl (%rsi), %eax # encoding: [0x23,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    andl (%rsi), %eax # encoding: [0x23,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x23,0x3e]
@@ -170,12 +148,6 @@ define i64 @and64rm(i64 noundef %a, ptr %b) {
 ; NDD-NEXT:    andq (%rsi), %rax # encoding: [0x48,0x23,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    andq (%rsi), %rax # encoding: [0x48,0x23,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x23,0x3e]
@@ -311,13 +283,6 @@ define i8 @and8mr(ptr %a, i8 noundef %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and8mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    andb (%rdi), %al # encoding: [0x22,0x07]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and8mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andb (%rdi), %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x22,0x37]
@@ -343,13 +308,6 @@ define i16 @and16mr(ptr %a, i16 noundef %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and16mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    andw (%rdi), %ax # encoding: [0x66,0x23,0x07]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and16mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andw (%rdi), %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x23,0x37]
@@ -374,12 +332,6 @@ define i32 @and32mr(ptr %a, i32 noundef %b) {
 ; NDD-NEXT:    andl (%rdi), %eax # encoding: [0x23,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and32mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    andl (%rdi), %eax # encoding: [0x23,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and32mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andl (%rdi), %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x23,0x37]
@@ -403,12 +355,6 @@ define i64 @and64mr(ptr %a, i64 noundef %b) {
 ; NDD-NEXT:    andq (%rdi), %rax # encoding: [0x48,0x23,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and64mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rsi, %rax # encoding: [0x48,0x89,0xf0]
-; IMMONLY-NEXT:    andq (%rdi), %rax # encoding: [0x48,0x23,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and64mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andq (%rdi), %rsi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x23,0x37]
@@ -432,12 +378,6 @@ define i16 @and16mi8(ptr %a) {
 ; NDD-NEXT:    andw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xe0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and16mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    andw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xe0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and16mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x27,0x7b]
@@ -461,12 +401,6 @@ define i32 @and32mi8(ptr %a) {
 ; NDD-NEXT:    andl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and32mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    andl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and32mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x27,0x7b]
@@ -508,12 +442,6 @@ define i8 @and8mi(ptr %a) {
 ; NDD-NEXT:    andb $123, %al # EVEX TO LEGACY Compression encoding: [0x24,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and8mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    andb $123, %al # EVEX TO LEGACY Compression encoding: [0x24,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and8mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andb $123, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x80,0x27,0x7b]
@@ -538,13 +466,6 @@ define i16 @and16mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x4D2
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and16mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    andw $1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x25,0xd2,0x04]
-; IMMONLY-NEXT:    # imm = 0x4D2
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and16mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x27,0xd2,0x04]
@@ -571,13 +492,6 @@ define i32 @and32mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: and32mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    andl $123456, %eax # EVEX TO LEGACY Compression encoding: [0x25,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: and32mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    andl $123456, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x27,0x40,0xe2,0x01,0x00]
@@ -722,15 +636,6 @@ define i1 @andflag8rm(ptr %ptr, i8 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: andflag8rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    notb %sil, %cl # encoding: [0x62,0xf4,0x74,0x18,0xf6,0xd6]
-; IMMONLY-NEXT:    andb (%rdi), %cl # encoding: [0x22,0x0f]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movb %cl, d64(%rip) # encoding: [0x88,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: andflag8rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    notb %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0xf6,0xd6]
@@ -766,15 +671,6 @@ define i1 @andflag16rm(ptr %ptr, i16 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: andflag16rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    notw %si, %cx # encoding: [0x62,0xf4,0x75,0x18,0xf7,0xd6]
-; IMMONLY-NEXT:    andw (%rdi), %cx # encoding: [0x66,0x23,0x0f]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: andflag16rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
@@ -809,14 +705,6 @@ define i1 @andflag32rm(ptr %ptr, i32 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: andflag32rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    andl (%rdi), %esi # encoding: [0x23,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movl %esi, d64(%rip) # encoding: [0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: andflag32rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    andl (%rdi), %esi # EVEX TO LEGACY Compression encoding: [0x23,0x37]
@@ -848,14 +736,6 @@ define i1 @andflag64rm(ptr %ptr, i64 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: andflag64rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    andq (%rdi), %rsi # encoding: [0x48,0x23,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movq %rsi, d64(%rip) # encoding: [0x48,0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: andflag64rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    andq (%rdi), %rsi # EVEX TO LEGACY Compression encoding: [0x48,0x23,0x37]
@@ -951,36 +831,18 @@ define i1 @andflag32ri(i32 %a) {
 }
 
 define i1 @andflag64ri(i64 %a) {
-; NDD-LABEL: andflag64ri:
-; NDD:       # %bb.0:
-; NDD-NEXT:    andq $123456, %rdi # encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
-; NDD-NEXT:    # imm = 0x1E240
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: andflag64ri:
-; IMM:       # %bb.0:
-; IMM-NEXT:    andq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
-; IMM-NEXT:    # imm = 0x1E240
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: andflag64ri:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    andq $123456, %rdi # encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
-; MEMONLY-NEXT:    # imm = 0x1E240
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: andflag64ri:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    andq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
+; CHECK-NEXT:    # imm = 0x1E240
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: andflag64ri:
 ; NF:       # %bb.0:
-; NF-NEXT:    andq $123456, %rdi # encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    andq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xe7,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
@@ -1038,33 +900,17 @@ define i1 @andflag32ri8(i32 %a) {
 }
 
 define i1 @andflag64ri8(i64 %a) {
-; NDD-LABEL: andflag64ri8:
-; NDD:       # %bb.0:
-; NDD-NEXT:    andq $123, %rdi # encoding: [0x48,0x83,0xe7,0x7b]
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: andflag64ri8:
-; IMM:       # %bb.0:
-; IMM-NEXT:    andq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe7,0x7b]
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: andflag64ri8:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    andq $123, %rdi # encoding: [0x48,0x83,0xe7,0x7b]
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: andflag64ri8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    andq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe7,0x7b]
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: andflag64ri8:
 ; NF:       # %bb.0:
-; NF-NEXT:    andq $123, %rdi # encoding: [0x48,0x83,0xe7,0x7b]
+; NF-NEXT:    andq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe7,0x7b]
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
 ; NF-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte

diff  --git a/llvm/test/CodeGen/X86/apx/cmov.ll b/llvm/test/CodeGen/X86/apx/cmov.ll
index a26b77756711b..41a5d21fcffa9 100644
--- a/llvm/test/CodeGen/X86/apx/cmov.ll
+++ b/llvm/test/CodeGen/X86/apx/cmov.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @cmov8(i8 %a, i8 %b, i8 %x, ptr %y.ptr) {
 ; CHECK-LABEL: cmov8:

diff  --git a/llvm/test/CodeGen/X86/apx/dec.ll b/llvm/test/CodeGen/X86/apx/dec.ll
index 09eccb13314bb..e68ef13f4ec14 100644
--- a/llvm/test/CodeGen/X86/apx/dec.ll
+++ b/llvm/test/CodeGen/X86/apx/dec.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM,MEM,BOTH
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs | FileCheck --check-prefix=NF %s
 
@@ -52,24 +50,14 @@ entry:
 }
 
 define i64 @dec64r(i64 noundef %a) {
-; NDD-LABEL: dec64r:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    leaq -1(%rdi), %rax
-; NDD-NEXT:    retq
-;
-; IMM-LABEL: dec64r:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    decq %rdi, %rax
-; IMM-NEXT:    retq
-;
-; MEMONLY-LABEL: dec64r:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    leaq -1(%rdi), %rax
-; MEMONLY-NEXT:    retq
+; CHECK-LABEL: dec64r:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    decq %rdi, %rax
+; CHECK-NEXT:    retq
 ;
 ; NF-LABEL: dec64r:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    leaq -1(%rdi), %rax
+; NF-NEXT:    {nf} decq %rdi, %rax
 ; NF-NEXT:    retq
 entry:
   %dec = sub i64 %a, 1
@@ -83,12 +71,6 @@ define i8 @dec8m(ptr %ptr) {
 ; NDD-NEXT:    decb %al
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: dec8m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax
-; IMMONLY-NEXT:    decb %al
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: dec8m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    decb (%rdi), %al
@@ -112,12 +94,6 @@ define i16 @dec16m(ptr %ptr) {
 ; NDD-NEXT:    decw %ax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: dec16m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax
-; IMMONLY-NEXT:    decw %ax
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: dec16m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    decw (%rdi), %ax
@@ -141,12 +117,6 @@ define i32 @dec32m(ptr %ptr) {
 ; NDD-NEXT:    decl %eax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: dec32m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax
-; IMMONLY-NEXT:    decl %eax
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: dec32m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    decl (%rdi), %eax
@@ -170,22 +140,10 @@ define i64 @dec64m(ptr %ptr) {
 ; NDD-NEXT:    decq %rax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: dec64m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax
-; IMMONLY-NEXT:    decq %rax
-; IMMONLY-NEXT:    retq
-;
-; MEMONLY-LABEL: dec64m:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    movq (%rdi), %rax
-; MEMONLY-NEXT:    decq %rax
-; MEMONLY-NEXT:    retq
-;
-; BOTH-LABEL: dec64m:
-; BOTH:       # %bb.0: # %entry
-; BOTH-NEXT:    decq (%rdi), %rax
-; BOTH-NEXT:    retq
+; MEM-LABEL: dec64m:
+; MEM:       # %bb.0: # %entry
+; MEM-NEXT:    decq (%rdi), %rax
+; MEM-NEXT:    retq
 ;
 ; NF-LABEL: dec64m:
 ; NF:       # %bb.0: # %entry

diff  --git a/llvm/test/CodeGen/X86/apx/imul.ll b/llvm/test/CodeGen/X86/apx/imul.ll
index dbc098ab8ef3f..3e0791f01dc37 100644
--- a/llvm/test/CodeGen/X86/apx/imul.ll
+++ b/llvm/test/CodeGen/X86/apx/imul.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs | FileCheck --check-prefix=NF %s
 
@@ -109,13 +107,6 @@ define i16 @mul16rm(i16 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: mul16rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movl %edi, %eax
-; IMM-NEXT:    imulw (%rsi), %ax
-; IMM-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: mul16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imulw (%rsi), %di, %ax
@@ -140,12 +131,6 @@ define i32 @mul32rm(i32 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    imull (%rsi), %eax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: mul32rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movl %edi, %eax
-; IMM-NEXT:    imull (%rsi), %eax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: mul32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imull (%rsi), %edi, %eax
@@ -169,12 +154,6 @@ define i64 @mul64rm(i64 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    imulq (%rsi), %rax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: mul64rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movq %rdi, %rax
-; IMM-NEXT:    imulq (%rsi), %rax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: mul64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imulq (%rsi), %rdi, %rax
@@ -199,13 +178,6 @@ define i16 @smul16rm(i16 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: smul16rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movl %edi, %eax
-; IMM-NEXT:    imulw (%rsi), %ax
-; IMM-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: smul16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imulw (%rsi), %di, %ax
@@ -231,12 +203,6 @@ define i32 @smul32rm(i32 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    imull (%rsi), %eax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: smul32rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movl %edi, %eax
-; IMM-NEXT:    imull (%rsi), %eax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: smul32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imull (%rsi), %edi, %eax
@@ -261,12 +227,6 @@ define i64 @smul64rm(i64 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    imulq (%rsi), %rax
 ; NDD-NEXT:    retq
 ;
-; IMM-LABEL: smul64rm:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    movq %rdi, %rax
-; IMM-NEXT:    imulq (%rsi), %rax
-; IMM-NEXT:    retq
-;
 ; MEM-LABEL: smul64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    imulq (%rsi), %rdi, %rax

diff  --git a/llvm/test/CodeGen/X86/apx/inc.ll b/llvm/test/CodeGen/X86/apx/inc.ll
index aaff438e95ac2..0a735ca73b8fe 100644
--- a/llvm/test/CodeGen/X86/apx/inc.ll
+++ b/llvm/test/CodeGen/X86/apx/inc.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,IMM,MEM,BOTH
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs | FileCheck --check-prefix=NF %s
 
@@ -52,24 +50,14 @@ entry:
 }
 
 define i64 @inc64r(i64 noundef %a) {
-; NDD-LABEL: inc64r:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    leaq 1(%rdi), %rax
-; NDD-NEXT:    retq
-;
-; IMM-LABEL: inc64r:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    incq %rdi, %rax
-; IMM-NEXT:    retq
-;
-; MEMONLY-LABEL: inc64r:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    leaq 1(%rdi), %rax
-; MEMONLY-NEXT:    retq
+; CHECK-LABEL: inc64r:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    incq %rdi, %rax
+; CHECK-NEXT:    retq
 ;
 ; NF-LABEL: inc64r:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    leaq 1(%rdi), %rax
+; NF-NEXT:    {nf} incq %rdi, %rax
 ; NF-NEXT:    retq
 entry:
   %inc = add i64 %a, 1
@@ -83,12 +71,6 @@ define i8 @inc8m(ptr %ptr) {
 ; NDD-NEXT:    incb %al
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: inc8m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax
-; IMMONLY-NEXT:    incb %al
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: inc8m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    incb (%rdi), %al
@@ -112,12 +94,6 @@ define i16 @inc16m(ptr %ptr) {
 ; NDD-NEXT:    incw %ax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: inc16m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax
-; IMMONLY-NEXT:    incw %ax
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: inc16m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    incw (%rdi), %ax
@@ -141,12 +117,6 @@ define i32 @inc32m(ptr %ptr) {
 ; NDD-NEXT:    incl %eax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: inc32m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax
-; IMMONLY-NEXT:    incl %eax
-; IMMONLY-NEXT:    retq
-;
 ; MEM-LABEL: inc32m:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    incl (%rdi), %eax
@@ -170,22 +140,10 @@ define i64 @inc64m(ptr %ptr) {
 ; NDD-NEXT:    incq %rax
 ; NDD-NEXT:    retq
 ;
-; IMMONLY-LABEL: inc64m:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax
-; IMMONLY-NEXT:    incq %rax
-; IMMONLY-NEXT:    retq
-;
-; MEMONLY-LABEL: inc64m:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    movq (%rdi), %rax
-; MEMONLY-NEXT:    incq %rax
-; MEMONLY-NEXT:    retq
-;
-; BOTH-LABEL: inc64m:
-; BOTH:       # %bb.0: # %entry
-; BOTH-NEXT:    incq (%rdi), %rax
-; BOTH-NEXT:    retq
+; MEM-LABEL: inc64m:
+; MEM:       # %bb.0: # %entry
+; MEM-NEXT:    incq (%rdi), %rax
+; MEM-NEXT:    retq
 ;
 ; NF-LABEL: inc64m:
 ; NF:       # %bb.0: # %entry
@@ -262,32 +220,18 @@ entry:
 }
 
 define i64 @uinc64r(i64 noundef %a) {
-; NDD-LABEL: uinc64r:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    incq %rdi
-; NDD-NEXT:    movq $-1, %rax
-; NDD-NEXT:    cmovneq %rdi, %rax
-; NDD-NEXT:    retq
-;
-; IMM-LABEL: uinc64r:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    incq %rdi, %rax
-; IMM-NEXT:    movq $-1, %rcx
-; IMM-NEXT:    cmoveq %rcx, %rax
-; IMM-NEXT:    retq
-;
-; MEMONLY-LABEL: uinc64r:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    incq %rdi
-; MEMONLY-NEXT:    movq $-1, %rax
-; MEMONLY-NEXT:    cmovneq %rdi, %rax
-; MEMONLY-NEXT:    retq
+; CHECK-LABEL: uinc64r:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    incq %rdi, %rax
+; CHECK-NEXT:    movq $-1, %rcx
+; CHECK-NEXT:    cmoveq %rcx, %rax
+; CHECK-NEXT:    retq
 ;
 ; NF-LABEL: uinc64r:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    incq %rdi
-; NF-NEXT:    movq $-1, %rax
-; NF-NEXT:    cmovneq %rdi, %rax
+; NF-NEXT:    incq %rdi, %rax
+; NF-NEXT:    movq $-1, %rcx
+; NF-NEXT:    cmoveq %rcx, %rax
 ; NF-NEXT:    retq
 entry:
   %inc = call i64 @llvm.uadd.sat.i64(i64 %a, i64 1)

diff  --git a/llvm/test/CodeGen/X86/apx/memfold-no-physreg.ll b/llvm/test/CodeGen/X86/apx/memfold-no-physreg.ll
index b85e26f5c1894..5142a5ef0c9e8 100644
--- a/llvm/test/CodeGen/X86/apx/memfold-no-physreg.ll
+++ b/llvm/test/CodeGen/X86/apx/memfold-no-physreg.ll
@@ -81,7 +81,7 @@ define fastcc i64 @foo(i32 %dim1, i32 %dim2, i32 %dim3, i32 %dim4, ptr %p1, ptr
 ; CHECK-NEXT:    .p2align 4
 ; CHECK-NEXT:  .LBB0_10: # %else_branch
 ; CHECK-NEXT:    # in Loop: Header=BB0_1 Depth=1
-; CHECK-NEXT:    leaq -1(%rax), %r25
+; CHECK-NEXT:    decq %rax, %r25
 ; CHECK-NEXT:    testb $1, %r24b
 ; CHECK-NEXT:    movq %r25, 16(%rbx) # 8-byte Spill
 ; CHECK-NEXT:    je .LBB0_11

diff  --git a/llvm/test/CodeGen/X86/apx/mul-i1024.ll b/llvm/test/CodeGen/X86/apx/mul-i1024.ll
index 101c5a4015f07..17375dde57195 100644
--- a/llvm/test/CodeGen/X86/apx/mul-i1024.ll
+++ b/llvm/test/CodeGen/X86/apx/mul-i1024.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+egpr | FileCheck %s --check-prefix=EGPR
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+egpr,+ndd,+prefer-ndd-imm,+prefer-ndd-mem | FileCheck %s --check-prefix=EGPR-NDD
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+egpr,+ndd,+prefer-ndd-mem | FileCheck %s --check-prefix=EGPR-NDD
 
 define void @test_1024(ptr %a, ptr %b, ptr %out) nounwind {
 ; EGPR-LABEL: test_1024:

diff  --git a/llvm/test/CodeGen/X86/apx/neg.ll b/llvm/test/CodeGen/X86/apx/neg.ll
index aed8c73795ca5..5319bf296faf4 100644
--- a/llvm/test/CodeGen/X86/apx/neg.ll
+++ b/llvm/test/CodeGen/X86/apx/neg.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+nf -verify-machineinstrs | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+nf -x86-enable-apx-for-relocation=true -verify-machineinstrs | FileCheck --check-prefix=NF %s
 

diff  --git a/llvm/test/CodeGen/X86/apx/not.ll b/llvm/test/CodeGen/X86/apx/not.ll
index fd5e3232b59c1..d2fb85abb5f10 100644
--- a/llvm/test/CodeGen/X86/apx/not.ll
+++ b/llvm/test/CodeGen/X86/apx/not.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @not8r(i8 noundef %a) {
 ; CHECK-LABEL: not8r:

diff  --git a/llvm/test/CodeGen/X86/apx/or.ll b/llvm/test/CodeGen/X86/apx/or.ll
index 0a6e98e89f3fc..7e2c4c1d86d1c 100644
--- a/llvm/test/CodeGen/X86/apx/or.ll
+++ b/llvm/test/CodeGen/X86/apx/or.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 
@@ -78,13 +76,6 @@ define i8 @or8rm(i8 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    orb (%rsi), %al # encoding: [0x0a,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x0a,0x3e]
@@ -110,13 +101,6 @@ define i16 @or16rm(i16 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    orw (%rsi), %ax # encoding: [0x66,0x0b,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x0b,0x3e]
@@ -141,12 +125,6 @@ define i32 @or32rm(i32 noundef %a, ptr %b) {
 ; NDD-NEXT:    orl (%rsi), %eax # encoding: [0x0b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    orl (%rsi), %eax # encoding: [0x0b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x0b,0x3e]
@@ -170,12 +148,6 @@ define i64 @or64rm(i64 noundef %a, ptr %b) {
 ; NDD-NEXT:    orq (%rsi), %rax # encoding: [0x48,0x0b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    orq (%rsi), %rax # encoding: [0x48,0x0b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x0b,0x3e]
@@ -311,13 +283,6 @@ define i8 @or8mr(ptr %a, i8 noundef %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or8mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    orb (%rdi), %al # encoding: [0x0a,0x07]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or8mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orb (%rdi), %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x0a,0x37]
@@ -343,13 +308,6 @@ define i16 @or16mr(ptr %a, i16 noundef %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or16mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    orw (%rdi), %ax # encoding: [0x66,0x0b,0x07]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or16mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orw (%rdi), %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x0b,0x37]
@@ -374,12 +332,6 @@ define i32 @or32mr(ptr %a, i32 noundef %b) {
 ; NDD-NEXT:    orl (%rdi), %eax # encoding: [0x0b,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or32mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    orl (%rdi), %eax # encoding: [0x0b,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or32mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orl (%rdi), %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x0b,0x37]
@@ -403,12 +355,6 @@ define i64 @or64mr(ptr %a, i64 noundef %b) {
 ; NDD-NEXT:    orq (%rdi), %rax # encoding: [0x48,0x0b,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or64mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rsi, %rax # encoding: [0x48,0x89,0xf0]
-; IMMONLY-NEXT:    orq (%rdi), %rax # encoding: [0x48,0x0b,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or64mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orq (%rdi), %rsi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x0b,0x37]
@@ -432,12 +378,6 @@ define i16 @or16mi8(ptr %a) {
 ; NDD-NEXT:    orw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or16mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    orw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xc8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or16mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x0f,0x7b]
@@ -461,12 +401,6 @@ define i32 @or32mi8(ptr %a) {
 ; NDD-NEXT:    orl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or32mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    orl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xc8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or32mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x0f,0x7b]
@@ -490,12 +424,6 @@ define i64 @or64mi8(ptr %a) {
 ; NDD-NEXT:    orq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xc8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or64mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    orq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xc8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or64mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x0f,0x7b]
@@ -519,12 +447,6 @@ define i8 @or8mi(ptr %a) {
 ; NDD-NEXT:    orb $123, %al # EVEX TO LEGACY Compression encoding: [0x0c,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or8mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    orb $123, %al # EVEX TO LEGACY Compression encoding: [0x0c,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or8mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orb $123, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x80,0x0f,0x7b]
@@ -549,13 +471,6 @@ define i16 @or16mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x4D2
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or16mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    orw $1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x0d,0xd2,0x04]
-; IMMONLY-NEXT:    # imm = 0x4D2
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or16mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x0f,0xd2,0x04]
@@ -582,13 +497,6 @@ define i32 @or32mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or32mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    orl $123456, %eax # EVEX TO LEGACY Compression encoding: [0x0d,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or32mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orl $123456, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x0f,0x40,0xe2,0x01,0x00]
@@ -615,13 +523,6 @@ define i64 @or64mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: or64mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    orq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0d,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: or64mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    orq $123456, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x0f,0x40,0xe2,0x01,0x00]
@@ -746,15 +647,6 @@ define i1 @orflag8rm(ptr %ptr, i8 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: orflag8rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    notb %sil, %cl # encoding: [0x62,0xf4,0x74,0x18,0xf6,0xd6]
-; IMMONLY-NEXT:    orb (%rdi), %cl # encoding: [0x0a,0x0f]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movb %cl, d64(%rip) # encoding: [0x88,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: orflag8rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    notb %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0xf6,0xd6]
@@ -790,15 +682,6 @@ define i1 @orflag16rm(ptr %ptr, i16 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: orflag16rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    notw %si, %cx # encoding: [0x62,0xf4,0x75,0x18,0xf7,0xd6]
-; IMMONLY-NEXT:    orw (%rdi), %cx # encoding: [0x66,0x0b,0x0f]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: orflag16rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    notw %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xf7,0xd6]
@@ -833,14 +716,6 @@ define i1 @orflag32rm(ptr %ptr, i32 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: orflag32rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    orl (%rdi), %esi # encoding: [0x0b,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movl %esi, d64(%rip) # encoding: [0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: orflag32rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    orl (%rdi), %esi # EVEX TO LEGACY Compression encoding: [0x0b,0x37]
@@ -872,14 +747,6 @@ define i1 @orflag64rm(ptr %ptr, i64 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: orflag64rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    orq (%rdi), %rsi # encoding: [0x48,0x0b,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movq %rsi, d64(%rip) # encoding: [0x48,0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: orflag64rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    orq (%rdi), %rsi # EVEX TO LEGACY Compression encoding: [0x48,0x0b,0x37]
@@ -975,36 +842,18 @@ define i1 @orflag32ri(i32 %a) {
 }
 
 define i1 @orflag64ri(i64 %a) {
-; NDD-LABEL: orflag64ri:
-; NDD:       # %bb.0:
-; NDD-NEXT:    orq $123456, %rdi # encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
-; NDD-NEXT:    # imm = 0x1E240
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: orflag64ri:
-; IMM:       # %bb.0:
-; IMM-NEXT:    orq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
-; IMM-NEXT:    # imm = 0x1E240
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: orflag64ri:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    orq $123456, %rdi # encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
-; MEMONLY-NEXT:    # imm = 0x1E240
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: orflag64ri:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    orq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
+; CHECK-NEXT:    # imm = 0x1E240
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: orflag64ri:
 ; NF:       # %bb.0:
-; NF-NEXT:    orq $123456, %rdi # encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    orq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xcf,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
@@ -1062,33 +911,17 @@ define i1 @orflag32ri8(i32 %a) {
 }
 
 define i1 @orflag64ri8(i64 %a) {
-; NDD-LABEL: orflag64ri8:
-; NDD:       # %bb.0:
-; NDD-NEXT:    orq $123, %rdi # encoding: [0x48,0x83,0xcf,0x7b]
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: orflag64ri8:
-; IMM:       # %bb.0:
-; IMM-NEXT:    orq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xcf,0x7b]
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: orflag64ri8:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    orq $123, %rdi # encoding: [0x48,0x83,0xcf,0x7b]
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: orflag64ri8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    orq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xcf,0x7b]
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: orflag64ri8:
 ; NF:       # %bb.0:
-; NF-NEXT:    orq $123, %rdi # encoding: [0x48,0x83,0xcf,0x7b]
+; NF-NEXT:    orq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xcf,0x7b]
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
 ; NF-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
@@ -1250,14 +1083,6 @@ define i64 @pr191165(i32 %a, ptr %b) {
 ; NDD-NEXT:    movslq %edi, %rax # encoding: [0x48,0x63,0xc7]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: pr191165:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl (%rsi), %eax # encoding: [0x8b,0x06]
-; IMMONLY-NEXT:    orl %edi, %eax # encoding: [0x09,0xf8]
-; IMMONLY-NEXT:    movl %eax, 0 # encoding: [0x89,0x04,0x25,0x00,0x00,0x00,0x00]
-; IMMONLY-NEXT:    movslq %edi, %rax # encoding: [0x48,0x63,0xc7]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: pr191165:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    orl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x0b,0x3e]

diff  --git a/llvm/test/CodeGen/X86/apx/rol.ll b/llvm/test/CodeGen/X86/apx/rol.ll
index 098ea96c4bae6..c1ee01681d321 100644
--- a/llvm/test/CodeGen/X86/apx/rol.ll
+++ b/llvm/test/CodeGen/X86/apx/rol.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @rol8m1(ptr %ptr) {
 ; NDD-LABEL: rol8m1:

diff  --git a/llvm/test/CodeGen/X86/apx/ror.ll b/llvm/test/CodeGen/X86/apx/ror.ll
index 4cb7421c218fb..b129e925671c8 100644
--- a/llvm/test/CodeGen/X86/apx/ror.ll
+++ b/llvm/test/CodeGen/X86/apx/ror.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @ror8m1(ptr %ptr) {
 ; NDD-LABEL: ror8m1:

diff  --git a/llvm/test/CodeGen/X86/apx/sar.ll b/llvm/test/CodeGen/X86/apx/sar.ll
index 91790e2f8f31e..7cd4f3053ed2b 100644
--- a/llvm/test/CodeGen/X86/apx/sar.ll
+++ b/llvm/test/CodeGen/X86/apx/sar.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @sar8m1(ptr %ptr) {
 ; NDD-LABEL: sar8m1:

diff  --git a/llvm/test/CodeGen/X86/apx/sbb.ll b/llvm/test/CodeGen/X86/apx/sbb.ll
index a7fda8eea8e0e..f595e6b547874 100644
--- a/llvm/test/CodeGen/X86/apx/sbb.ll
+++ b/llvm/test/CodeGen/X86/apx/sbb.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM,BOTH
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i8 @sbb8rr(i8 %a, i8 %b, i8 %x, i8 %y) nounwind {
 ; CHECK-LABEL: sbb8rr:
@@ -65,14 +63,6 @@ define i8 @sbb8rm(i8 %a, ptr %ptr, i8 %x, i8 %y) nounwind {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb8rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    cmpb %dl, %cl # encoding: [0x38,0xd1]
-; IMMONLY-NEXT:    sbbb (%rsi), %al # encoding: [0x1a,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb8rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpb %dl, %cl # encoding: [0x38,0xd1]
@@ -95,14 +85,6 @@ define i16 @sbb16rm(i16 %a, ptr %ptr, i16 %x, i16 %y) nounwind {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb16rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    cmpw %dx, %cx # encoding: [0x66,0x39,0xd1]
-; IMMONLY-NEXT:    sbbw (%rsi), %ax # encoding: [0x66,0x1b,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb16rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpw %dx, %cx # encoding: [0x66,0x39,0xd1]
@@ -124,13 +106,6 @@ define i32 @sbb32rm(i32 %a, ptr %ptr, i32 %x, i32 %y) nounwind {
 ; NDD-NEXT:    sbbl (%rsi), %eax # encoding: [0x1b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb32rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]
-; IMMONLY-NEXT:    sbbl (%rsi), %eax # encoding: [0x1b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb32rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]
@@ -152,13 +127,6 @@ define i64 @sbb64rm(i64 %a, ptr %ptr, i64 %x, i64 %y) nounwind {
 ; NDD-NEXT:    sbbq (%rsi), %rax # encoding: [0x48,0x1b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb64rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    cmpq %rdx, %rcx # encoding: [0x48,0x39,0xd1]
-; IMMONLY-NEXT:    sbbq (%rsi), %rax # encoding: [0x48,0x1b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb64rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpq %rdx, %rcx # encoding: [0x48,0x39,0xd1]
@@ -274,13 +242,6 @@ define i8 @sbb8mr(i8 %a, ptr %ptr, i8 %x, i8 %y) nounwind {
 ; NDD-NEXT:    sbbb %dil, %al # EVEX TO LEGACY Compression encoding: [0x40,0x18,0xf8]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb8mr:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movzbl (%rsi), %eax # encoding: [0x0f,0xb6,0x06]
-; IMMONLY-NEXT:    cmpb %dl, %cl # encoding: [0x38,0xd1]
-; IMMONLY-NEXT:    sbbb %dil, %al # EVEX TO LEGACY Compression encoding: [0x40,0x18,0xf8]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb8mr:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpb %dl, %cl # encoding: [0x38,0xd1]
@@ -302,13 +263,6 @@ define i16 @sbb16mr(i16 %a, ptr %ptr, i16 %x, i16 %y) nounwind {
 ; NDD-NEXT:    sbbw %di, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x19,0xf8]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb16mr:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movzwl (%rsi), %eax # encoding: [0x0f,0xb7,0x06]
-; IMMONLY-NEXT:    cmpw %dx, %cx # encoding: [0x66,0x39,0xd1]
-; IMMONLY-NEXT:    sbbw %di, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x19,0xf8]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb16mr:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpw %dx, %cx # encoding: [0x66,0x39,0xd1]
@@ -330,13 +284,6 @@ define i32 @sbb32mr(i32 %a, ptr %ptr, i32 %x, i32 %y) nounwind {
 ; NDD-NEXT:    sbbl %edi, %eax # EVEX TO LEGACY Compression encoding: [0x19,0xf8]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb32mr:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl (%rsi), %eax # encoding: [0x8b,0x06]
-; IMMONLY-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]
-; IMMONLY-NEXT:    sbbl %edi, %eax # EVEX TO LEGACY Compression encoding: [0x19,0xf8]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb32mr:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpl %edx, %ecx # encoding: [0x39,0xd1]
@@ -358,13 +305,6 @@ define i64 @sbb64mr(i64 %a, ptr %ptr, i64 %x, i64 %y) nounwind {
 ; NDD-NEXT:    sbbq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x19,0xf8]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb64mr:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movq (%rsi), %rax # encoding: [0x48,0x8b,0x06]
-; IMMONLY-NEXT:    cmpq %rdx, %rcx # encoding: [0x48,0x39,0xd1]
-; IMMONLY-NEXT:    sbbq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x19,0xf8]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb64mr:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpq %rdx, %rcx # encoding: [0x48,0x39,0xd1]
@@ -386,13 +326,6 @@ define i16 @sbb16mi8(ptr %ptr, i16 %x, i16 %y) nounwind {
 ; NDD-NEXT:    sbbw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xd8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb16mi8:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; IMMONLY-NEXT:    sbbw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xd8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb16mi8:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
@@ -414,13 +347,6 @@ define i32 @sbb32mi8(ptr %ptr, i32 %x, i32 %y) nounwind {
 ; NDD-NEXT:    sbbl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xd8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb32mi8:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
-; IMMONLY-NEXT:    sbbl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xd8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb32mi8:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
@@ -442,13 +368,6 @@ define i64 @sbb64mi8(ptr %ptr, i64 %x, i64 %y) nounwind {
 ; NDD-NEXT:    sbbq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xd8,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb64mi8:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
-; IMMONLY-NEXT:    sbbq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xd8,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb64mi8:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
@@ -470,13 +389,6 @@ define i8 @sbb8mi(ptr %ptr, i8 %x, i8 %y) nounwind {
 ; NDD-NEXT:    sbbb $123, %al # EVEX TO LEGACY Compression encoding: [0x1c,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb8mi:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    cmpb %sil, %dl # encoding: [0x40,0x38,0xf2]
-; IMMONLY-NEXT:    sbbb $123, %al # EVEX TO LEGACY Compression encoding: [0x1c,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb8mi:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpb %sil, %dl # encoding: [0x40,0x38,0xf2]
@@ -499,14 +411,6 @@ define i16 @sbb16mi(ptr %ptr, i16 %x, i16 %y) nounwind {
 ; NDD-NEXT:    # imm = 0x4D2
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb16mi:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
-; IMMONLY-NEXT:    sbbw $1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x1d,0xd2,0x04]
-; IMMONLY-NEXT:    # imm = 0x4D2
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb16mi:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpw %si, %dx # encoding: [0x66,0x39,0xf2]
@@ -530,14 +434,6 @@ define i32 @sbb32mi(ptr %ptr, i32 %x, i32 %y) nounwind {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb32mi:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
-; IMMONLY-NEXT:    sbbl $123456, %eax # EVEX TO LEGACY Compression encoding: [0x1d,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb32mi:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpl %esi, %edx # encoding: [0x39,0xf2]
@@ -561,14 +457,6 @@ define i64 @sbb64mi(ptr %ptr, i64 %x, i64 %y) nounwind {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sbb64mi:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
-; IMMONLY-NEXT:    sbbq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x1d,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sbb64mi:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    cmpq %rsi, %rdx # encoding: [0x48,0x39,0xf2]
@@ -642,7 +530,3 @@ define void @sbb64mr_legacy(i64 %a, ptr %ptr, i64 %x, i64 %y) nounwind {
   store i64 %r, ptr %ptr
   ret void
 }
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; BOTH: {{.*}}
-; IMM: {{.*}}
-; MEMONLY: {{.*}}

diff  --git a/llvm/test/CodeGen/X86/apx/shl.ll b/llvm/test/CodeGen/X86/apx/shl.ll
index 8d4ff1fae4643..c246d7d464dc3 100644
--- a/llvm/test/CodeGen/X86/apx/shl.ll
+++ b/llvm/test/CodeGen/X86/apx/shl.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 

diff  --git a/llvm/test/CodeGen/X86/apx/shld.ll b/llvm/test/CodeGen/X86/apx/shld.ll
index de91ac0acca38..6e335080566df 100644
--- a/llvm/test/CodeGen/X86/apx/shld.ll
+++ b/llvm/test/CodeGen/X86/apx/shld.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i16 @shld16rrcl(i16 noundef %a, i16 noundef %b, i8 %cl) {
 ; CHECK-LABEL: shld16rrcl:

diff  --git a/llvm/test/CodeGen/X86/apx/shr.ll b/llvm/test/CodeGen/X86/apx/shr.ll
index d0146b0641883..cf87fe6744619 100644
--- a/llvm/test/CodeGen/X86/apx/shr.ll
+++ b/llvm/test/CodeGen/X86/apx/shr.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 

diff  --git a/llvm/test/CodeGen/X86/apx/shrd.ll b/llvm/test/CodeGen/X86/apx/shrd.ll
index 56def4116c47b..b984ef4397997 100644
--- a/llvm/test/CodeGen/X86/apx/shrd.ll
+++ b/llvm/test/CodeGen/X86/apx/shrd.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,NDD
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,MEM
 
 define i16 @shrd16rrcl(i16 noundef %a, i16 noundef %b, i8 %cl) {
 ; CHECK-LABEL: shrd16rrcl:

diff  --git a/llvm/test/CodeGen/X86/apx/sub.ll b/llvm/test/CodeGen/X86/apx/sub.ll
index 7ae41c63ed9fe..34af966465d93 100644
--- a/llvm/test/CodeGen/X86/apx/sub.ll
+++ b/llvm/test/CodeGen/X86/apx/sub.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM,BOTH
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 
@@ -74,13 +72,6 @@ define i8 @sub8rm(i8 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    subb (%rsi), %al # encoding: [0x2a,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x2a,0x3e]
@@ -106,13 +97,6 @@ define i16 @sub16rm(i16 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    subw (%rsi), %ax # encoding: [0x66,0x2b,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x2b,0x3e]
@@ -137,12 +121,6 @@ define i32 @sub32rm(i32 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    subl (%rsi), %eax # encoding: [0x2b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    subl (%rsi), %eax # encoding: [0x2b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x2b,0x3e]
@@ -166,12 +144,6 @@ define i64 @sub64rm(i64 noundef %a, ptr %ptr) {
 ; NDD-NEXT:    subq (%rsi), %rax # encoding: [0x48,0x2b,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    subq (%rsi), %rax # encoding: [0x48,0x2b,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x2b,0x3e]
@@ -219,24 +191,14 @@ entry:
 }
 
 define i64 @sub64ri8(i64 noundef %a) {
-; NDD-LABEL: sub64ri8:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    leaq 128(%rdi), %rax # encoding: [0x48,0x8d,0x87,0x80,0x00,0x00,0x00]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: sub64ri8:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    subq $-128, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xef,0x80]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: sub64ri8:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    leaq 128(%rdi), %rax # encoding: [0x48,0x8d,0x87,0x80,0x00,0x00,0x00]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: sub64ri8:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    subq $-128, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0xef,0x80]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: sub64ri8:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    leaq 128(%rdi), %rax # encoding: [0x48,0x8d,0x87,0x80,0x00,0x00,0x00]
+; NF-NEXT:    {nf} subq $-128, %rdi, %rax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0x83,0xef,0x80]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
     %sub = sub i64 %a, -128
@@ -291,31 +253,16 @@ entry:
 }
 
 define i64 @sub64ri(i64 noundef %a) {
-; NDD-LABEL: sub64ri:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
-; NDD-NEXT:    # imm = 0x80000000
-; NDD-NEXT:    addq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xf8]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: sub64ri:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    subq $-2147483648, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xef,0x00,0x00,0x00,0x80]
-; IMM-NEXT:    # imm = 0x80000000
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: sub64ri:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
-; MEMONLY-NEXT:    # imm = 0x80000000
-; MEMONLY-NEXT:    addq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xf8]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: sub64ri:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    subq $-2147483648, %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0xef,0x00,0x00,0x00,0x80]
+; CHECK-NEXT:    # imm = 0x80000000
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: sub64ri:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
+; NF-NEXT:    {nf} subq $-2147483648, %rdi, %rax # EVEX TO EVEX Compression encoding: [0x62,0xf4,0xfc,0x1c,0x81,0xef,0x00,0x00,0x00,0x80]
 ; NF-NEXT:    # imm = 0x80000000
-; NF-NEXT:    addq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x01,0xf8]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
     %sub = sub i64 %a, -2147483648
@@ -329,12 +276,6 @@ define i8 @sub8mr(ptr %a, i8 noundef %b) {
 ; NDD-NEXT:    subb %sil, %al # EVEX TO LEGACY Compression encoding: [0x40,0x28,0xf0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub8mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    subb %sil, %al # EVEX TO LEGACY Compression encoding: [0x40,0x28,0xf0]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub8mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subb %sil, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x28,0x37]
@@ -358,12 +299,6 @@ define i16 @sub16mr(ptr %a, i16 noundef %b) {
 ; NDD-NEXT:    subw %si, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x29,0xf0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub16mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    subw %si, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x29,0xf0]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub16mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subw %si, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x29,0x37]
@@ -387,12 +322,6 @@ define i32 @sub32mr(ptr %a, i32 noundef %b) {
 ; NDD-NEXT:    subl %esi, %eax # EVEX TO LEGACY Compression encoding: [0x29,0xf0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub32mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    subl %esi, %eax # EVEX TO LEGACY Compression encoding: [0x29,0xf0]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub32mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subl %esi, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x29,0x37]
@@ -416,12 +345,6 @@ define i64 @sub64mr(ptr %a, i64 noundef %b) {
 ; NDD-NEXT:    subq %rsi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x29,0xf0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub64mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    subq %rsi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x29,0xf0]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub64mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subq %rsi, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x29,0x37]
@@ -445,12 +368,6 @@ define i16 @sub16mi8(ptr %a) {
 ; NDD-NEXT:    subw $-128, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xe8,0x80]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub16mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    subw $-128, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xe8,0x80]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub16mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subw $-128, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x2f,0x80]
@@ -474,12 +391,6 @@ define i32 @sub32mi8(ptr %a) {
 ; NDD-NEXT:    subl $-128, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe8,0x80]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub32mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    subl $-128, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xe8,0x80]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub32mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subl $-128, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x2f,0x80]
@@ -500,30 +411,18 @@ define i64 @sub64mi8(ptr %a) {
 ; NDD-LABEL: sub64mi8:
 ; NDD:       # %bb.0: # %entry
 ; NDD-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NDD-NEXT:    subq $-128, %rax # encoding: [0x48,0x83,0xe8,0x80]
+; NDD-NEXT:    subq $-128, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe8,0x80]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub64mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    subq $-128, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe8,0x80]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: sub64mi8:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; MEMONLY-NEXT:    subq $-128, %rax # encoding: [0x48,0x83,0xe8,0x80]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
-;
-; BOTH-LABEL: sub64mi8:
-; BOTH:       # %bb.0: # %entry
-; BOTH-NEXT:    subq $-128, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x2f,0x80]
-; BOTH-NEXT:    retq # encoding: [0xc3]
+; MEM-LABEL: sub64mi8:
+; MEM:       # %bb.0: # %entry
+; MEM-NEXT:    subq $-128, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x2f,0x80]
+; MEM-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: sub64mi8:
 ; NF:       # %bb.0: # %entry
 ; NF-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; NF-NEXT:    subq $-128, %rax # encoding: [0x48,0x83,0xe8,0x80]
+; NF-NEXT:    subq $-128, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe8,0x80]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i64, ptr %a
@@ -538,12 +437,6 @@ define i8 @sub8mi(ptr %a) {
 ; NDD-NEXT:    addb $-123, %al # EVEX TO LEGACY Compression encoding: [0x04,0x85]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub8mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    addb $-123, %al # EVEX TO LEGACY Compression encoding: [0x04,0x85]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub8mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addb $-123, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x80,0x07,0x85]
@@ -568,13 +461,6 @@ define i16 @sub16mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0xFB2E
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub16mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    addw $-1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x05,0x2e,0xfb]
-; IMMONLY-NEXT:    # imm = 0xFB2E
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub16mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addw $-1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x07,0x2e,0xfb]
@@ -601,13 +487,6 @@ define i32 @sub32mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0xFFFE1DC0
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub32mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    addl $-123456, %eax # EVEX TO LEGACY Compression encoding: [0x05,0xc0,0x1d,0xfe,0xff]
-; IMMONLY-NEXT:    # imm = 0xFFFE1DC0
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub32mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    addl $-123456, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x07,0xc0,0x1d,0xfe,0xff]
@@ -629,18 +508,11 @@ entry:
 define i64 @sub64mi(ptr %a) {
 ; NDD-LABEL: sub64mi:
 ; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
+; NDD-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
+; NDD-NEXT:    subq $-2147483648, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x2d,0x00,0x00,0x00,0x80]
 ; NDD-NEXT:    # imm = 0x80000000
-; NDD-NEXT:    addq (%rdi), %rax # encoding: [0x48,0x03,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: sub64mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    subq $-2147483648, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x2d,0x00,0x00,0x00,0x80]
-; IMMONLY-NEXT:    # imm = 0x80000000
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: sub64mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    subq $-2147483648, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x2f,0x00,0x00,0x00,0x80]
@@ -649,9 +521,9 @@ define i64 @sub64mi(ptr %a) {
 ;
 ; NF-LABEL: sub64mi:
 ; NF:       # %bb.0: # %entry
-; NF-NEXT:    movl $2147483648, %eax # encoding: [0xb8,0x00,0x00,0x00,0x80]
+; NF-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
+; NF-NEXT:    subq $-2147483648, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x2d,0x00,0x00,0x00,0x80]
 ; NF-NEXT:    # imm = 0x80000000
-; NF-NEXT:    addq (%rdi), %rax # encoding: [0x48,0x03,0x07]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
   %t= load i64, ptr %a
@@ -756,15 +628,6 @@ define i8 @subflag8rm(i8 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: subflag8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    subb (%rsi), %dil # encoding: [0x40,0x2a,0x3e]
-; IMMONLY-NEXT:    movzbl %dil, %ecx # encoding: [0x40,0x0f,0xb6,0xcf]
-; IMMONLY-NEXT:    cmovael %ecx, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc1]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: subflag8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
@@ -797,14 +660,6 @@ define i16 @subflag16rm(i16 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: subflag16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    subw (%rsi), %di # encoding: [0x66,0x2b,0x3e]
-; IMMONLY-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: subflag16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
@@ -834,13 +689,6 @@ define i32 @subflag32rm(i32 noundef %a, ptr %b) {
 ; NDD-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: subflag32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    subl (%rsi), %edi # encoding: [0x2b,0x3e]
-; IMMONLY-NEXT:    cmovael %edi, %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: subflag32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
@@ -868,13 +716,6 @@ define i64 @subflag64rm(i64 noundef %a, ptr %b) {
 ; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: subflag64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    subq (%rsi), %rdi # encoding: [0x48,0x2b,0x3e]
-; IMMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: subflag64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
@@ -935,31 +776,17 @@ entry:
 }
 
 define i64 @subflag64ri8(i64 noundef %a) {
-; NDD-LABEL: subflag64ri8:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; NDD-NEXT:    subq $123, %rdi # encoding: [0x48,0x83,0xef,0x7b]
-; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: subflag64ri8:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMM-NEXT:    subq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xef,0x7b]
-; IMM-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: subflag64ri8:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; MEMONLY-NEXT:    subq $123, %rdi # encoding: [0x48,0x83,0xef,0x7b]
-; MEMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: subflag64ri8:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; CHECK-NEXT:    subq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xef,0x7b]
+; CHECK-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: subflag64ri8:
 ; NF:       # %bb.0: # %entry
 ; NF-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; NF-NEXT:    subq $123, %rdi # encoding: [0x48,0x83,0xef,0x7b]
+; NF-NEXT:    subq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xef,0x7b]
 ; NF-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
 ; NF-NEXT:    retq # encoding: [0xc3]
 entry:
@@ -1035,34 +862,18 @@ entry:
 }
 
 define i64 @subflag64ri(i64 noundef %a) {
-; NDD-LABEL: subflag64ri:
-; NDD:       # %bb.0: # %entry
-; NDD-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; NDD-NEXT:    subq $123456, %rdi # encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
-; NDD-NEXT:    # imm = 0x1E240
-; NDD-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: subflag64ri:
-; IMM:       # %bb.0: # %entry
-; IMM-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMM-NEXT:    subq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
-; IMM-NEXT:    # imm = 0x1E240
-; IMM-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: subflag64ri:
-; MEMONLY:       # %bb.0: # %entry
-; MEMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; MEMONLY-NEXT:    subq $123456, %rdi # encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
-; MEMONLY-NEXT:    # imm = 0x1E240
-; MEMONLY-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: subflag64ri:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; CHECK-NEXT:    subq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
+; CHECK-NEXT:    # imm = 0x1E240
+; CHECK-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: subflag64ri:
 ; NF:       # %bb.0: # %entry
 ; NF-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; NF-NEXT:    subq $123456, %rdi # encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    subq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xef,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
 ; NF-NEXT:    cmovaeq %rdi, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x43,0xc7]
 ; NF-NEXT:    retq # encoding: [0xc3]
@@ -1312,57 +1123,6 @@ define fastcc void @fold_with_physical_reg(ptr %arg0, i64 %arg1, ptr %arg2, i1 %
 ; NDD-NEXT:    jmp .LBB50_1 # encoding: [0xeb,A]
 ; NDD-NEXT:    # fixup A - offset: 1, value: .LBB50_1, kind: FK_PCRel_1
 ;
-; IMMONLY-LABEL: fold_with_physical_reg:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    pushq %rbp # encoding: [0x55]
-; IMMONLY-NEXT:    movq %rsp, %rbp # encoding: [0x48,0x89,0xe5]
-; IMMONLY-NEXT:    pushq %r15 # encoding: [0x41,0x57]
-; IMMONLY-NEXT:    pushq %r14 # encoding: [0x41,0x56]
-; IMMONLY-NEXT:    pushq %r13 # encoding: [0x41,0x55]
-; IMMONLY-NEXT:    pushq %r12 # encoding: [0x41,0x54]
-; IMMONLY-NEXT:    pushq %rbx # encoding: [0x53]
-; IMMONLY-NEXT:    subq $24, %rsp # encoding: [0x48,0x83,0xec,0x18]
-; IMMONLY-NEXT:    movl %ecx, %r14d # encoding: [0x41,0x89,0xce]
-; IMMONLY-NEXT:    movq %rdx, %rbx # encoding: [0x48,0x89,0xd3]
-; IMMONLY-NEXT:    movq %rsi, %r12 # encoding: [0x49,0x89,0xf4]
-; IMMONLY-NEXT:    movq %rdi, %r13 # encoding: [0x49,0x89,0xfd]
-; IMMONLY-NEXT:    leaq 15(%rsi), %rax # encoding: [0x48,0x8d,0x46,0x0f]
-; IMMONLY-NEXT:    andq $-16, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xe0,0xf0]
-; IMMONLY-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; IMMONLY-NEXT:    # encoding: [0x48,0x89,0x45,0xd0]
-; IMMONLY-NEXT:    .p2align 4
-; IMMONLY-NEXT:  .LBB50_1: # %bb1
-; IMMONLY-NEXT:    # =>This Loop Header: Depth=1
-; IMMONLY-NEXT:    # Child Loop BB50_2 Depth 2
-; IMMONLY-NEXT:    movq %rsp, %rax # encoding: [0x48,0x89,0xe0]
-; IMMONLY-NEXT:    subq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Folded Reload
-; IMMONLY-NEXT:    # encoding: [0x48,0x2b,0x45,0xd0]
-; IMMONLY-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
-; IMMONLY-NEXT:    # encoding: [0x48,0x89,0x45,0xc8]
-; IMMONLY-NEXT:    movq %rax, %rsp # encoding: [0x48,0x89,0xc4]
-; IMMONLY-NEXT:    xorl %r15d, %r15d # encoding: [0x45,0x31,0xff]
-; IMMONLY-NEXT:    .p2align 4
-; IMMONLY-NEXT:  .LBB50_2: # %bb2
-; IMMONLY-NEXT:    # Parent Loop BB50_1 Depth=1
-; IMMONLY-NEXT:    # => This Inner Loop Header: Depth=2
-; IMMONLY-NEXT:    xorps %xmm0, %xmm0 # encoding: [0x0f,0x57,0xc0]
-; IMMONLY-NEXT:    movq %r13, %rdi # encoding: [0x4c,0x89,0xef]
-; IMMONLY-NEXT:    xorl %esi, %esi # encoding: [0x31,0xf6]
-; IMMONLY-NEXT:    xorl %edx, %edx # encoding: [0x31,0xd2]
-; IMMONLY-NEXT:    xorl %ecx, %ecx # encoding: [0x31,0xc9]
-; IMMONLY-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; IMMONLY-NEXT:    callq *%rax # encoding: [0xff,0xd0]
-; IMMONLY-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
-; IMMONLY-NEXT:    # encoding: [0x48,0x8b,0x45,0xc8]
-; IMMONLY-NEXT:    movq $0, (%rax,%r15,8) # encoding: [0x4a,0xc7,0x04,0xf8,0x00,0x00,0x00,0x00]
-; IMMONLY-NEXT:    movq $0, (%rbx) # encoding: [0x48,0xc7,0x03,0x00,0x00,0x00,0x00]
-; IMMONLY-NEXT:    testb $1, %r14b # encoding: [0x41,0xf6,0xc6,0x01]
-; IMMONLY-NEXT:    movq %r12, %r15 # encoding: [0x4d,0x89,0xe7]
-; IMMONLY-NEXT:    je .LBB50_2 # encoding: [0x74,A]
-; IMMONLY-NEXT:    # fixup A - offset: 1, value: .LBB50_2, kind: FK_PCRel_1
-; IMMONLY-NEXT:    jmp .LBB50_1 # encoding: [0xeb,A]
-; IMMONLY-NEXT:    # fixup A - offset: 1, value: .LBB50_1, kind: FK_PCRel_1
-;
 ; MEM-LABEL: fold_with_physical_reg:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    pushq %rbp # encoding: [0x55]

diff  --git a/llvm/test/CodeGen/X86/apx/xor.ll b/llvm/test/CodeGen/X86/apx/xor.ll
index aebde64790c0c..796da82435a5c 100644
--- a/llvm/test/CodeGen/X86/apx/xor.ll
+++ b/llvm/test/CodeGen/X86/apx/xor.ll
@@ -1,8 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,IMMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM,MEMONLY
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-imm,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,IMM,MEM
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,+prefer-ndd-mem -verify-machineinstrs --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,MEM
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ndd,nf -x86-enable-apx-for-relocation=true -verify-machineinstrs --show-mc-encoding | FileCheck --check-prefix=NF %s
 
@@ -78,13 +76,6 @@ define i8 @xor8rm(i8 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor8rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    xorb (%rsi), %al # encoding: [0x32,0x06]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor8rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorb (%rsi), %dil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x32,0x3e]
@@ -110,13 +101,6 @@ define i16 @xor16rm(i16 noundef %a, ptr %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor16rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    xorw (%rsi), %ax # encoding: [0x66,0x33,0x06]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor16rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorw (%rsi), %di, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x33,0x3e]
@@ -141,12 +125,6 @@ define i32 @xor32rm(i32 noundef %a, ptr %b) {
 ; NDD-NEXT:    xorl (%rsi), %eax # encoding: [0x33,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor32rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %edi, %eax # encoding: [0x89,0xf8]
-; IMMONLY-NEXT:    xorl (%rsi), %eax # encoding: [0x33,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor32rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl (%rsi), %edi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x33,0x3e]
@@ -170,12 +148,6 @@ define i64 @xor64rm(i64 noundef %a, ptr %b) {
 ; NDD-NEXT:    xorq (%rsi), %rax # encoding: [0x48,0x33,0x06]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor64rm:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rdi, %rax # encoding: [0x48,0x89,0xf8]
-; IMMONLY-NEXT:    xorq (%rsi), %rax # encoding: [0x48,0x33,0x06]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor64rm:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorq (%rsi), %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x33,0x3e]
@@ -311,13 +283,6 @@ define i8 @xor8mr(ptr %a, i8 noundef %b) {
 ; NDD-NEXT:    # kill: def $al killed $al killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor8mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    xorb (%rdi), %al # encoding: [0x32,0x07]
-; IMMONLY-NEXT:    # kill: def $al killed $al killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor8mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorb (%rdi), %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x32,0x37]
@@ -343,13 +308,6 @@ define i16 @xor16mr(ptr %a, i16 noundef %b) {
 ; NDD-NEXT:    # kill: def $ax killed $ax killed $eax
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor16mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    xorw (%rdi), %ax # encoding: [0x66,0x33,0x07]
-; IMMONLY-NEXT:    # kill: def $ax killed $ax killed $eax
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor16mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorw (%rdi), %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x33,0x37]
@@ -374,12 +332,6 @@ define i32 @xor32mr(ptr %a, i32 noundef %b) {
 ; NDD-NEXT:    xorl (%rdi), %eax # encoding: [0x33,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor32mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl %esi, %eax # encoding: [0x89,0xf0]
-; IMMONLY-NEXT:    xorl (%rdi), %eax # encoding: [0x33,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor32mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl (%rdi), %esi, %eax # encoding: [0x62,0xf4,0x7c,0x18,0x33,0x37]
@@ -403,12 +355,6 @@ define i64 @xor64mr(ptr %a, i64 noundef %b) {
 ; NDD-NEXT:    xorq (%rdi), %rax # encoding: [0x48,0x33,0x07]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor64mr:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq %rsi, %rax # encoding: [0x48,0x89,0xf0]
-; IMMONLY-NEXT:    xorq (%rdi), %rax # encoding: [0x48,0x33,0x07]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor64mr:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorq (%rdi), %rsi, %rax # encoding: [0x62,0xf4,0xfc,0x18,0x33,0x37]
@@ -432,12 +378,6 @@ define i16 @xor16mi8(ptr %a) {
 ; NDD-NEXT:    xorw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xf0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor16mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    xorw $123, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x83,0xf0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor16mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorw $123, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x83,0x37,0x7b]
@@ -461,12 +401,6 @@ define i32 @xor32mi8(ptr %a) {
 ; NDD-NEXT:    xorl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xf0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor32mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    xorl $123, %eax # EVEX TO LEGACY Compression encoding: [0x83,0xf0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor32mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl $123, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x83,0x37,0x7b]
@@ -490,12 +424,6 @@ define i64 @xor64mi8(ptr %a) {
 ; NDD-NEXT:    xorq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xf0,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor64mi8:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    xorq $123, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xf0,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor64mi8:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorq $123, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x83,0x37,0x7b]
@@ -519,12 +447,6 @@ define i8 @xor8mi(ptr %a) {
 ; NDD-NEXT:    xorb $123, %al # EVEX TO LEGACY Compression encoding: [0x34,0x7b]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor8mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzbl (%rdi), %eax # encoding: [0x0f,0xb6,0x07]
-; IMMONLY-NEXT:    xorb $123, %al # EVEX TO LEGACY Compression encoding: [0x34,0x7b]
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor8mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorb $123, (%rdi), %al # encoding: [0x62,0xf4,0x7c,0x18,0x80,0x37,0x7b]
@@ -549,13 +471,6 @@ define i16 @xor16mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x4D2
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor16mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movzwl (%rdi), %eax # encoding: [0x0f,0xb7,0x07]
-; IMMONLY-NEXT:    xorw $1234, %ax # EVEX TO LEGACY Compression encoding: [0x66,0x35,0xd2,0x04]
-; IMMONLY-NEXT:    # imm = 0x4D2
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor16mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorw $1234, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0x81,0x37,0xd2,0x04]
@@ -582,13 +497,6 @@ define i32 @xor32mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor32mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movl (%rdi), %eax # encoding: [0x8b,0x07]
-; IMMONLY-NEXT:    xorl $123456, %eax # EVEX TO LEGACY Compression encoding: [0x35,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor32mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorl $123456, (%rdi), %eax # encoding: [0x62,0xf4,0x7c,0x18,0x81,0x37,0x40,0xe2,0x01,0x00]
@@ -615,13 +523,6 @@ define i64 @xor64mi(ptr %a) {
 ; NDD-NEXT:    # imm = 0x1E240
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xor64mi:
-; IMMONLY:       # %bb.0: # %entry
-; IMMONLY-NEXT:    movq (%rdi), %rax # encoding: [0x48,0x8b,0x07]
-; IMMONLY-NEXT:    xorq $123456, %rax # EVEX TO LEGACY Compression encoding: [0x48,0x35,0x40,0xe2,0x01,0x00]
-; IMMONLY-NEXT:    # imm = 0x1E240
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xor64mi:
 ; MEM:       # %bb.0: # %entry
 ; MEM-NEXT:    xorq $123456, (%rdi), %rax # encoding: [0x62,0xf4,0xfc,0x18,0x81,0x37,0x40,0xe2,0x01,0x00]
@@ -746,15 +647,6 @@ define i1 @xorflag8rm(ptr %ptr, i8 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xorflag8rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    xorb (%rdi), %sil # encoding: [0x40,0x32,0x37]
-; IMMONLY-NEXT:    xorb $-1, %sil, %cl # encoding: [0x62,0xf4,0x74,0x18,0x80,0xf6,0xff]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movb %cl, d64(%rip) # encoding: [0x88,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xorflag8rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    xorb (%rdi), %sil, %al # encoding: [0x62,0xf4,0x7c,0x18,0x32,0x37]
@@ -790,15 +682,6 @@ define i1 @xorflag16rm(ptr %ptr, i16 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xorflag16rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    xorw (%rdi), %si # encoding: [0x66,0x33,0x37]
-; IMMONLY-NEXT:    xorw $-1, %si, %cx # encoding: [0x62,0xf4,0x75,0x18,0x83,0xf6,0xff]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movw %cx, d64(%rip) # encoding: [0x66,0x89,0x0d,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xorflag16rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    xorw (%rdi), %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0x33,0x37]
@@ -833,14 +716,6 @@ define i1 @xorflag32rm(ptr %ptr, i32 %b) {
 ; NDD-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xorflag32rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    xorl (%rdi), %esi # encoding: [0x33,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movl %esi, d64(%rip) # encoding: [0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 2, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xorflag32rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    xorl (%rdi), %esi # EVEX TO LEGACY Compression encoding: [0x33,0x37]
@@ -872,14 +747,6 @@ define i1 @xorflag64rm(ptr %ptr, i64 %b) {
 ; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; IMMONLY-LABEL: xorflag64rm:
-; IMMONLY:       # %bb.0:
-; IMMONLY-NEXT:    xorq (%rdi), %rsi # encoding: [0x48,0x33,0x37]
-; IMMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMMONLY-NEXT:    movq %rsi, d64(%rip) # encoding: [0x48,0x89,0x35,A,A,A,A]
-; IMMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMMONLY-NEXT:    retq # encoding: [0xc3]
-;
 ; MEM-LABEL: xorflag64rm:
 ; MEM:       # %bb.0:
 ; MEM-NEXT:    xorq (%rdi), %rsi # EVEX TO LEGACY Compression encoding: [0x48,0x33,0x37]
@@ -975,36 +842,18 @@ define i1 @xorflag32ri(i32 %a) {
 }
 
 define i1 @xorflag64ri(i64 %a) {
-; NDD-LABEL: xorflag64ri:
-; NDD:       # %bb.0:
-; NDD-NEXT:    xorq $123456, %rdi # encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
-; NDD-NEXT:    # imm = 0x1E240
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: xorflag64ri:
-; IMM:       # %bb.0:
-; IMM-NEXT:    xorq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
-; IMM-NEXT:    # imm = 0x1E240
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: xorflag64ri:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    xorq $123456, %rdi # encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
-; MEMONLY-NEXT:    # imm = 0x1E240
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: xorflag64ri:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
+; CHECK-NEXT:    # imm = 0x1E240
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: xorflag64ri:
 ; NF:       # %bb.0:
-; NF-NEXT:    xorq $123456, %rdi # encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
+; NF-NEXT:    xorq $123456, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x81,0xf7,0x40,0xe2,0x01,0x00]
 ; NF-NEXT:    # imm = 0x1E240
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
@@ -1062,33 +911,17 @@ define i1 @xorflag32ri8(i32 %a) {
 }
 
 define i1 @xorflag64ri8(i64 %a) {
-; NDD-LABEL: xorflag64ri8:
-; NDD:       # %bb.0:
-; NDD-NEXT:    xorq $123, %rdi # encoding: [0x48,0x83,0xf7,0x7b]
-; NDD-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; NDD-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; NDD-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; NDD-NEXT:    retq # encoding: [0xc3]
-;
-; IMM-LABEL: xorflag64ri8:
-; IMM:       # %bb.0:
-; IMM-NEXT:    xorq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xf7,0x7b]
-; IMM-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; IMM-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; IMM-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; IMM-NEXT:    retq # encoding: [0xc3]
-;
-; MEMONLY-LABEL: xorflag64ri8:
-; MEMONLY:       # %bb.0:
-; MEMONLY-NEXT:    xorq $123, %rdi # encoding: [0x48,0x83,0xf7,0x7b]
-; MEMONLY-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
-; MEMONLY-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
-; MEMONLY-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
-; MEMONLY-NEXT:    retq # encoding: [0xc3]
+; CHECK-LABEL: xorflag64ri8:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    xorq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xf7,0x7b]
+; CHECK-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
+; CHECK-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
+; CHECK-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte
+; CHECK-NEXT:    retq # encoding: [0xc3]
 ;
 ; NF-LABEL: xorflag64ri8:
 ; NF:       # %bb.0:
-; NF-NEXT:    xorq $123, %rdi # encoding: [0x48,0x83,0xf7,0x7b]
+; NF-NEXT:    xorq $123, %rdi # EVEX TO LEGACY Compression encoding: [0x48,0x83,0xf7,0x7b]
 ; NF-NEXT:    sete %al # encoding: [0x0f,0x94,0xc0]
 ; NF-NEXT:    movq %rdi, d64(%rip) # encoding: [0x48,0x89,0x3d,A,A,A,A]
 ; NF-NEXT:    # fixup A - offset: 3, value: d64, kind: reloc_riprel_4byte

diff  --git a/llvm/test/CodeGen/X86/cmp.ll b/llvm/test/CodeGen/X86/cmp.ll
index 86610cc052ade..ed3f0e0f0aa71 100644
--- a/llvm/test/CodeGen/X86/cmp.ll
+++ b/llvm/test/CodeGen/X86/cmp.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,NO-NDD
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ndd,+prefer-ndd-imm -show-mc-encoding | FileCheck --check-prefixes=CHECK,NDD %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ndd -show-mc-encoding | FileCheck --check-prefixes=CHECK,NDD %s
 
 @d = dso_local global i8 0, align 1
 @d64 = dso_local global i64 0


        


More information about the llvm-commits mailing list