]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/i386/i386.md
combine: Fix ICE in try_combine on pr112494.c [PR112560]
[thirdparty/gcc.git] / gcc / config / i386 / i386.md
index f83064ec3357000a5b5a74ce5c5902a04ef7e95b..10ae3113ae8dbeeab7143a30a2a445338e1dbb20 100644 (file)
@@ -1,5 +1,5 @@
 ;; GCC machine description for IA-32 and x86-64.
-;; Copyright (C) 1988-2023 Free Software Foundation, Inc.
+;; Copyright (C) 1988-2024 Free Software Foundation, Inc.
 ;; Mostly by William Schelter.
 ;; x86_64 support added by Jan Hubicka
 ;;
   ;; For USER_MSR support
   UNSPECV_URDMSR
   UNSPECV_UWRMSR
+
+  ;; For AMX-TILE
+  UNSPECV_LDTILECFG
+  UNSPECV_STTILECFG
 ])
 
 ;; Constants to represent rounding modes in the ROUND instruction
 ;; Processor type.
 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,nehalem,
                    atom,slm,glm,haswell,generic,lujiazui,yongfeng,amdfam10,bdver1,
-                   bdver2,bdver3,bdver4,btver2,znver1,znver2,znver3,znver4"
+                   bdver2,bdver3,bdver4,btver2,znver1,znver2,znver3,znver4,
+                   znver5"
   (const (symbol_ref "ix86_schedule")))
 
 ;; A basic instruction type.  Refinements due to arguments to be
 
 ;; Main data type used by the insn
 (define_attr "mode"
-  "unknown,none,QI,HI,SI,DI,TI,OI,XI,HF,BF,SF,DF,XF,TF,V32HF,V16HF,V8HF,
-   V16SF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF,V8DF,V4HF,V4BF,V2HF,V2BF"
+  "unknown,none,QI,HI,SI,DI,TI,OI,XI,HF,BF,SF,DF,XF,TF,
+   V32HF,V16HF,V8HF,V4HF,V2HF,V32BF,V16BF,V8BF,V4BF,V2BF,
+   V16SF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF,V8DF"
   (const_string "unknown"))
 
 ;; The CPU unit operations uses.
 ;; SSE and x87 SFmode and DFmode floating point modes
 (define_mode_iterator MODEF [SF DF])
 
+(define_mode_iterator MODEF248 [BF HF SF (DF "TARGET_SSE2")])
+
 ;; SSE floating point modes
 (define_mode_iterator MODEFH [(HF "TARGET_AVX512FP16") SF DF])
 
    (V64QI "b") (V32HI "w") (V16SI "d") (V8DI "q")])
 
 ;; SSE vector suffix for floating point modes
-(define_mode_attr ssevecmodesuffix [(SF "ps") (DF "pd")])
+;; BF HF use same suffix as SF for logic operations.
+(define_mode_attr ssevecmodesuffix [(BF "ps") (HF "ps") (SF "ps") (DF "pd")])
 
 ;; SSE vector mode corresponding to a scalar mode
 (define_mode_attr ssevecmode
 
 ;; AVX512F vector mode corresponding to a scalar mode
 (define_mode_attr avx512fvecmode
-  [(QI "V64QI") (HI "V32HI") (SI "V16SI") (DI "V8DI") (SF "V16SF") (DF "V8DF")])
+  [(QI "V64QI") (HI "V32HI") (SI "V16SI") (DI "V8DI")
+   (HF "V32HF") (BF "V32BF") (SF "V16SF") (DF "V8DF")])
 
 ;; Instruction suffix for REX 64bit operators.
 (define_mode_attr rex64suffix [(SI "{l}") (DI "{q}")])
 (include "bdver3.md")
 (include "btver2.md")
 (include "znver.md")
-(include "znver4.md")
+(include "zn4zn5.md")
 (include "geode.md")
 (include "atom.md")
 (include "slm.md")
 
 (define_mode_iterator SWI1248_AVX512BWDQ_64
   [(QI "TARGET_AVX512DQ") HI
-   (SI "TARGET_AVX512BW")
-   (DI "TARGET_AVX512BW && TARGET_EVEX512 && TARGET_64BIT")])
+   (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW && TARGET_64BIT")])
 
 (define_insn "*cmp<mode>_ccz_1"
   [(set (reg FLAGS_REG)
              (set (match_dup 4) (ior:DWIH (match_dup 4) (match_dup 5)))])]
 {
   split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[2]);
-  /* Placing the SUBREG pieces in pseudos helps reload.  */
-  for (int i = 0; i < 4; i++)
-    if (SUBREG_P (operands[i]))
-      operands[i] = force_reg (<MODE>mode, operands[i]);
 
   operands[4] = gen_reg_rtx (<MODE>mode);
 
 
 (define_insn "@pushfl<mode>2"
   [(set (match_operand:W 0 "push_operand" "=<")
-       (unspec:W [(match_operand:CC 1 "flags_reg_operand")]
+       (unspec:W [(match_operand 1 "flags_reg_operand")]
                  UNSPEC_PUSHFL))]
-  ""
+  "GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_CC"
   "pushf{<imodesuffix>}"
   [(set_attr "type" "push")
    (set_attr "mode" "<MODE>")])
    && !x86_64_immediate_operand (operands[1], DImode)
    && !x86_64_zext_immediate_operand (operands[1], DImode)
    && !((UINTVAL (operands[1]) >> ctz_hwi (UINTVAL (operands[1])))
-        & ~(HOST_WIDE_INT) 0xffffffff)
+       & ~HOST_WIDE_INT_C (0xffffffff))
    && peep2_regno_dead_p (0, FLAGS_REG)"
   [(set (match_dup 0) (match_dup 1))
    (parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))
   [(set (match_operand:SWI48 0 "general_reg_operand")
        (match_dup 4))]
 {
-  HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~(HOST_WIDE_INT)0xff00;
+  HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~HOST_WIDE_INT_C (0xff00);
   tmp |= (INTVAL (operands[3]) & 0xff) << 8;
   operands[4] = gen_int_mode (tmp, <SWI48:MODE>mode);
 })
            (eq_attr "alternative" "12")
              (const_string "x64_avx512bw")
            (eq_attr "alternative" "13")
-             (const_string "avx512bw_512")
+             (const_string "avx512bw")
           ]
           (const_string "*")))
    (set (attr "mmx_isa")
   "split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);")
 
 (define_mode_attr kmov_isa
-  [(QI "avx512dq") (HI "avx512f") (SI "avx512bw") (DI "avx512bw_512")])
+  [(QI "avx512dq") (HI "avx512f") (SI "avx512bw") (DI "avx512bw")])
 
 (define_insn "zero_extend<mode>di2"
   [(set (match_operand:DI 0 "register_operand" "=r,*r,*k")
    && optimize_insn_for_speed_p ()
    && reload_completed
    && (!EXT_REX_SSE_REG_P (operands[0])
-       || TARGET_AVX512VL || TARGET_EVEX512)"
+       || TARGET_AVX512VL)"
    [(set (match_dup 2)
         (float_extend:V2DF
           (vec_select:V2SF
       /* If it is unsafe to overwrite upper half of source, we need
         to move to destination and unpack there.  */
       if (REGNO (operands[0]) != REGNO (operands[1])
-         || (EXT_REX_SSE_REG_P (operands[1])
-             && !TARGET_AVX512VL))
+         || (EXT_REX_SSE_REG_P (operands[1]) && !TARGET_AVX512VL))
        {
          rtx tmp = lowpart_subreg (SFmode, operands[0], DFmode);
          emit_move_insn (tmp, operands[1]);
        (plus:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")
                    (match_operand:SDWIM 2 "<general_hilo_operand>")))]
   ""
-  "ix86_expand_binary_operator (PLUS, <MODE>mode, operands,
-                               TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_binary_operator (PLUS, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 (define_insn_and_split "*add<dwi>3_doubleword"
-  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
+  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r")
        (plus:<DWI>
-         (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r")
-         (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,r")))
+         (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r")
+         (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,r")))
    (clobber (reg:CC FLAGS_REG))]
   "ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
       DONE;
     }
 }
-[(set_attr "isa" "*,*,apx_ndd,apx_ndd")])
+[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")])
 
 (define_insn_and_split "*add<dwi>3_doubleword_zext"
   [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,&r,&r")
            (match_operand:DWIH 2 "nonimmediate_operand" "rm,r,rm,r"))
          (match_operand:<DWI> 1 "nonimmediate_operand" "0,0,r,m")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
   "&& reload_completed"
   [(parallel [(set (reg:CCC FLAGS_REG)
   "#"
   "&& reload_completed"
   [(set (match_dup 0) (match_dup 4))
-   (set (match_dup 5) (match_dup 2))
    (parallel [(set (reg:CCC FLAGS_REG)
                   (compare:CCC
                     (plus:DWIH (match_dup 0) (match_dup 1))
                     (match_dup 0)))
              (set (match_dup 0)
                   (plus:DWIH (match_dup 0) (match_dup 1)))])
+   (set (match_dup 5) (match_dup 2))
    (parallel [(set (match_dup 5)
                   (plus:DWIH
                     (plus:DWIH
  "split_double_mode (<DWI>mode, &operands[0], 1, &operands[0], &operands[5]);")
 
 (define_insn "*add<mode>_1"
-  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r,r,r,r,r")
+  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r,r,r,r")
        (plus:SWI48
-         (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r,rm,r,m,r")
-         (match_operand:SWI48 2 "x86_64_general_operand" "re,BM,0,le,r,e,je,BM")))
+         (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r,rje,jM,r")
+         (match_operand:SWI48 2 "x86_64_general_operand" "re,BM,0,le,r,e,BM")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (PLUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
                    : "add{<imodesuffix>}\t{%2, %0|%0, %2}";
     }
 }
-  [(set_attr "isa" "*,*,*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd")
+  [(set_attr "isa" "*,*,*,*,apx_ndd,apx_ndd,apx_ndd")
    (set (attr "type")
      (cond [(eq_attr "alternative" "3")
               (const_string "lea")
 ;; patterns constructed from addsi_1 to match.
 
 (define_insn "addsi_1_zext"
-  [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
+  [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r")
        (zero_extend:DI
-         (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,r,rm")
-                  (match_operand:SI 2 "x86_64_general_operand" "rBMe,0,le,rBMe,re"))))
+         (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,r,rm,rjM")
+                  (match_operand:SI 2 "x86_64_general_operand" "rBMe,0,le,rBMe,r,e"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
                     : "add{l}\t{%2, %k0|%k0, %2}";
     }
 }
-  [(set_attr "isa" "*,*,*,apx_ndd,apx_ndd")
+  [(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd")
    (set (attr "type")
      (cond [(eq_attr "alternative" "2")
              (const_string "lea")
        (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r,Yp,rm,r")
                 (match_operand:HI 2 "general_operand" "rn,m,0,ln,rn,m")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (PLUS, HImode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (PLUS, HImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
        (eq:CCO
          (plus:<QPWI>
            (sign_extend:<QPWI>
-             (match_operand:<DWI> 1 "nonimmediate_operand" "%0,rm"))
+             (match_operand:<DWI> 1 "nonimmediate_operand" "%0,rjM"))
            (match_operand:<QPWI> 3 "const_scalar_int_operand" "n,n"))
          (sign_extend:<QPWI>
            (plus:<DWI>
        (minus:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")
                     (match_operand:SDWIM 2 "<general_hilo_operand>")))]
   ""
-  "ix86_expand_binary_operator (MINUS, <MODE>mode, operands,
-                               TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_binary_operator (MINUS, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 (define_insn_and_split "*sub<dwi>3_doubleword"
   [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
          (match_operand:<DWI> 1 "nonimmediate_operand" "0,0,ro,r")
          (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "#"
   "&& reload_completed"
   [(parallel [(set (reg:CC FLAGS_REG)
          (zero_extend:<DWI>
            (match_operand:DWIH 2 "nonimmediate_operand" "rm,r,rm,r"))))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
   "&& reload_completed"
   [(parallel [(set (reg:CC FLAGS_REG)
 [(set_attr "isa" "*,*,apx_ndd,apx_ndd")])
 
 (define_insn "*sub<mode>_1"
-  [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
+  [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r,r")
        (minus:SWI
-         (match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r")
-         (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")))
+         (match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,rjM,r")
+         (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r,<i>,<m>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
   sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
+  sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
   sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "isa" "*,*,apx_ndd,apx_ndd")
+  [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")
    (set_attr "type" "alu")
    (set_attr "mode" "<MODE>")])
 
          (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,r,rm")
                    (match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)"
   "@
   sub{l}\t{%2, %k0|%k0, %2}
   sub{l}\t{%2, %1, %k0|%k0, %1, %2}
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
        (minus:SWI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
          (minus:SI (match_dup 1)
                    (match_dup 2))))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (MINUS, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)"
   "@
   sub{l}\t{%2, %k0|%k0, %2}
   sub{l}\t{%2, %1, %k0|%k0, %1, %2}
                   (minus:SWI (match_dup 1) (match_dup 2)))))
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
        (minus:SWI (match_dup 1) (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
                     (match_operand:SWI 2 "x86_64_immediate_operand" "<i>,<i>")))))
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r")
        (minus:SWI (match_dup 1) (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && CONST_INT_P (operands[2])
    && INTVAL (operands[2]) == INTVAL (operands[3])"
   "@
            (minus:<DWI> (match_dup 1) (match_dup 2)))))
    (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
        (minus:<DWI> (match_dup 1) (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "#"
   "&& reload_completed"
   [(parallel [(set (reg:CC FLAGS_REG)
              (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "<di>,<di>")))))
    (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r")
        (minus:<DWI> (match_dup 1) (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && CONST_SCALAR_INT_P (operands[2])
    && rtx_equal_p (operands[2], operands[3])"
   "#"
            (match_dup 1)
            (match_op_dup 5 [(match_dup 3) (const_int 0)]))
          (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
            (match_dup 1)
            (match_op_dup 5 [(match_dup 3) (const_int 0)]))
          (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && CONST_INT_P (operands[2])
    && INTVAL (operands[2]) == INTVAL (operands[6])"
   "@
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>i,r,r")
        (minus:SWI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCmode)
-   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
   sub{<imodesuffix>}\t{%2, %0|%0, %2}
          (minus:SI (match_dup 1)
                    (match_dup 2))))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
-   && ix86_binary_operator_ok (MINUS, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)"
   "@
   sub{l}\t{%2, %1|%1, %2}
   sub{l}\t{%2, %1, %k0|%k0, %1, %2}
                     (match_operand:SI 1 "nonimmediate_operand" "%0,r,rm"))
            (match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)"
   "@
   adc{l}\t{%2, %k0|%k0, %2}
   adc{l}\t{%2, %1, %k0|%k0, %1, %2}
             (match_dup 1)))
       (set (match_operand:SWI48 0 "nonimmediate_operand")
           (plus:SWI48 (match_dup 1) (match_dup 2)))])]
-  "ix86_binary_operator_ok (PLUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)")
+  "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)")
 
 (define_insn "*addcarry<mode>_1"
   [(set (reg:CCC FLAGS_REG)
             [(match_operand 3 "flags_reg_operand") (const_int 0)]))
          (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
               [(reg FLAGS_REG) (const_int 0)]))
            (match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)"
   "@
   sbb{l}\t{%2, %k0|%k0, %2}
   sbb{l}\t{%2, %1, %k0|%k0, %1, %2}
                       (match_operator:SWI48 5 "ix86_carry_flag_operator"
                         [(match_dup 3) (const_int 0)]))
                     (match_dup 2)))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
   sbb{<imodesuffix>}\t{%2, %0|%0, %2}
             (match_operand:SWI48 2 "<general_operand>")))
       (set (match_operand:SWI48 0 "register_operand")
           (minus:SWI48 (match_dup 1) (match_dup 2)))])]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)")
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)")
 
 (define_expand "uaddc<mode>5"
   [(match_operand:SWI48 0 "register_operand")
   [(set (reg:CCC FLAGS_REG)
        (compare:CCC
            (plus:SWI
-               (match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r")
-               (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>"))
+               (match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,rjM,r")
+               (match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r,<i>,<m>"))
            (match_dup 1)))
-   (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
+   (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r,r")
        (plus:SWI (match_dup 1) (match_dup 2)))]
   "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
    add{<imodesuffix>}\t{%2, %0|%0, %2}
    add{<imodesuffix>}\t{%2, %0|%0, %2}
    add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
+   add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
    add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}"
-  [(set_attr "isa" "*,*,apx_ndd,apx_ndd")
+  [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")
    (set_attr "type" "alu")
    (set_attr "mode" "<MODE>")])
 
          (match_dup 1)))
    (set (match_operand:DI 0 "register_operand" "=r,r,r")
        (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
-  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)"
   "@
   add{l}\t{%2, %k0|%k0, %2}
   add{l}\t{%2, %1, %k0|%k0, %1, %2}
          (match_dup 2)))
    (set (match_operand:DI 0 "register_operand" "=r,r,r")
        (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
-  "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)"
   "@
   add{l}\t{%2, %k0|%k0, %2}
   add{l}\t{%2, %1, %k0|%k0, %1, %2}
   [(set (reg:CCC FLAGS_REG)
        (compare:CCC
          (plus:<DWI>
-           (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r")
-           (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o"))
+           (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r")
+           (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o"))
          (match_dup 1)))
-   (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
+   (set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r")
        (plus:<DWI> (match_dup 1) (match_dup 2)))]
   "ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
   else
     operands[6] = gen_rtx_ZERO_EXTEND (<DWI>mode, operands[5]);
 }
-[(set_attr "isa" "*,*,apx_ndd,apx_ndd")])
+[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")])
 
 ;; x == 0 with zero flag test can be done also as x < 1U with carry flag
 ;; test, where the latter is preferrable if we have some carry consuming
   "CONST_INT_P (operands[2])
    && (<MODE>mode != DImode
        || INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000))
-   && ix86_binary_operator_ok (PLUS, <MODE>mode, operands,
-                              TARGET_APX_NDD)
+   && ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)
    && ix86_pre_reload_split ()"
   "#"
   "&& 1"
                    (const_int 0)))
          (match_operand:SWI 2 "<general_operand>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                           TARGET_APX_NDD)
+  "ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && ix86_pre_reload_split ()"
   "#"
   "&& 1"
   "CONST_INT_P (operands[2])
    && (<MODE>mode != DImode
        || INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000))
-   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                              TARGET_APX_NDD)
+   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && ix86_pre_reload_split ()"
   "#"
   "&& 1"
   "CONST_INT_P (operands[2])
    && (<MODE>mode != DImode
        || INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000))
-   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands,
-                              TARGET_APX_NDD)
+   && ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)
    && ix86_pre_reload_split ()"
   "#"
   "&& 1"
               (operands[0], gen_lowpart (mode, operands[1]),
                <MODE>mode, mode, 1));
   else
-    ix86_expand_binary_operator (AND, <MODE>mode, operands,
-                                TARGET_APX_NDD);
+    ix86_expand_binary_operator (AND, <MODE>mode, operands, TARGET_APX_NDD);
 
   DONE;
 })
 
 (define_insn_and_split "*and<dwi>3_doubleword"
-  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
+  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r")
        (and:<DWI>
-        (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r")
-        (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o")))
+        (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r")
+        (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o")))
    (clobber (reg:CC FLAGS_REG))]
   "ix86_binary_operator_ok (AND, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
        emit_insn_deleted_note_p = true;
     }
   else
-    ix86_expand_binary_operator (AND, <MODE>mode, &operands[0],
-                                TARGET_APX_NDD);
+    ix86_expand_binary_operator (AND, <MODE>mode, &operands[0], TARGET_APX_NDD);
 
   if (operands[5] == const0_rtx)
     emit_move_insn (operands[3], const0_rtx);
        emit_note (NOTE_INSN_DELETED);
     }
   else
-    ix86_expand_binary_operator (AND, <MODE>mode, &operands[3],
-                                TARGET_APX_NDD);
+    ix86_expand_binary_operator (AND, <MODE>mode, &operands[3], TARGET_APX_NDD);
 
   DONE;
 }
-[(set_attr "isa" "*,*,apx_ndd,apx_ndd")])
+[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")])
 
 (define_insn "*anddi_1"
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm,r,r,r,r,?k")
+  [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm,r,r,r,r,r,?k")
        (and:DI
-        (match_operand:DI 1 "nonimmediate_operand" "%0,r,0,0,rm,r,qm,k")
-        (match_operand:DI 2 "x86_64_szext_general_operand" "Z,Z,re,m,re,m,L,k")))
+        (match_operand:DI 1 "nonimmediate_operand" "%0,r,0,0,rm,rjM,r,qm,k")
+        (match_operand:DI 2 "x86_64_szext_general_operand" "Z,Z,re,m,r,e,m,L,k")))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (AND, DImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (AND, DImode, operands, TARGET_APX_NDD)"
   "@
    and{l}\t{%k2, %k0|%k0, %k2}
    and{l}\t{%k2, %k1, %k0|%k0, %k1, %k2}
    and{q}\t{%2, %0|%0, %2}
    and{q}\t{%2, %1, %0|%0, %1, %2}
    and{q}\t{%2, %1, %0|%0, %1, %2}
+   and{q}\t{%2, %1, %0|%0, %1, %2}
    #
    #"
-  [(set_attr "isa" "x64,apx_ndd,x64,x64,apx_ndd,apx_ndd,x64,avx512bw_512")
-   (set_attr "type" "alu,alu,alu,alu,alu,alu,imovx,msklog")
-   (set_attr "length_immediate" "*,*,*,*,*,*,0,*")
+  [(set_attr "isa" "x64,apx_ndd,x64,x64,apx_ndd,apx_ndd,apx_ndd,x64,avx512bw")
+   (set_attr "type" "alu,alu,alu,alu,alu,alu,alu,imovx,msklog")
+   (set_attr "length_immediate" "*,*,*,*,*,*,*,0,*")
    (set (attr "prefix_rex")
      (if_then_else
        (and (eq_attr "type" "imovx")
                 (match_operand 1 "ext_QIreg_operand")))
        (const_string "1")
        (const_string "*")))
-   (set_attr "mode" "SI,SI,DI,DI,DI,DI,SI,DI")])
+   (set_attr "mode" "SI,SI,DI,DI,DI,DI,DI,SI,DI")])
 
 (define_insn_and_split "*anddi_1_btr"
   [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*andsi_1_zext"
-  [(set (match_operand:DI 0 "register_operand" "=r,r,r")
+  [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
        (zero_extend:DI
-         (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,r")
-                 (match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM"))))
+         (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r")
+                 (match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (AND, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (AND, SImode, operands, TARGET_APX_NDD)"
   "@
   and{l}\t{%2, %k0|%k0, %2}
   and{l}\t{%2, %1, %k0|%k0, %1, %2}
+  and{l}\t{%2, %1, %k0|%k0, %1, %2}
   and{l}\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "type" "alu")
-   (set_attr "isa" "*,apx_ndd,apx_ndd")
+   (set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd")
    (set_attr "mode" "SI")])
 
 (define_insn "*and<mode>_1"
-  [(set (match_operand:SWI24 0 "nonimmediate_operand" "=rm,r,r,r,Ya,?k")
-       (and:SWI24 (match_operand:SWI24 1 "nonimmediate_operand" "%0,0,rm,r,qm,k")
-                  (match_operand:SWI24 2 "<general_operand>" "r<i>,<m>,r<i>,<m>,L,k")))
+  [(set (match_operand:SWI24 0 "nonimmediate_operand" "=rm,r,r,r,r,Ya,?k")
+       (and:SWI24 (match_operand:SWI24 1 "nonimmediate_operand" "%0,0,rm,rjM,r,qm,k")
+                  (match_operand:SWI24 2 "<general_operand>" "r<i>,<m>,r,<i>,<m>,L,k")))
    (clobber (reg:CC FLAGS_REG))]
   "ix86_binary_operator_ok (AND, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
    and{<imodesuffix>}\t{%2, %0|%0, %2}
    and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
    and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
+   and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
    #
    #"
   [(set (attr "isa")
-       (cond [(eq_attr "alternative" "2,3")
+       (cond [(eq_attr "alternative" "2,3,4")
                 (const_string "apx_ndd")
-              (eq_attr "alternative" "5")
+              (eq_attr "alternative" "6")
                 (if_then_else (eq_attr "mode" "SI")
                   (const_string "avx512bw")
                   (const_string "avx512f"))
              ]
              (const_string "*")))
-   (set_attr "type" "alu,alu,alu,alu,imovx,msklog")
-   (set_attr "length_immediate" "*,*,*,*,0,*")
+   (set_attr "type" "alu,alu,alu,alu,alu,imovx,msklog")
+   (set_attr "length_immediate" "*,*,*,*,*,0,*")
    (set (attr "prefix_rex")
      (if_then_else
        (and (eq_attr "type" "imovx")
                 (match_operand 1 "ext_QIreg_operand")))
        (const_string "1")
        (const_string "*")))
-   (set_attr "mode" "<MODE>,<MODE>,<MODE>,<MODE>,SI,<MODE>")])
+   (set_attr "mode" "<MODE>,<MODE>,<MODE>,<MODE>,<MODE>,SI,<MODE>")])
 
 (define_insn "*andqi_1"
   [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r,?k")
    (set (match_operand:SWI124 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
        (and:SWI124 (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCNOmode)
-   && ix86_binary_operator_ok (AND, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (AND, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   and{<imodesuffix>}\t{%2, %0|%0, %2}
   and{<imodesuffix>}\t{%2, %0|%0, %2}
          (not:SWI48 (match_operand:SWI48 1 "register_operand" "r,r,k"))
          (match_operand:SWI48 2 "nonimmediate_operand" "r,m,k")))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_BMI
-   || (TARGET_AVX512BW && (<MODE>mode == SImode || TARGET_EVEX512))"
+  "TARGET_BMI || TARGET_AVX512BW"
   "@
    andn\t{%2, %1, %0|%0, %1, %2}
    andn\t{%2, %1, %0|%0, %1, %2}
    #"
-  [(set_attr "isa" "bmi,bmi,<kmov_isa>")
+  [(set_attr "isa" "bmi,bmi,avx512bw")
    (set_attr "type" "bitmanip,bitmanip,msklog")
    (set_attr "btver2_decode" "direct, double,*")
    (set_attr "mode" "<MODE>")])
       && !x86_64_hilo_general_operand (operands[2], <MODE>mode))
     operands[2] = force_reg (<MODE>mode, operands[2]);
 
-  ix86_expand_binary_operator (<CODE>, <MODE>mode, operands,
-                              TARGET_APX_NDD);
+  ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD);
   DONE;
 })
 
 (define_insn_and_split "*<code><dwi>3_doubleword"
-  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r")
+  [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r")
        (any_or:<DWI>
-        (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r")
-        (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o")))
+        (match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,rjO,r")
+        (match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,o")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (<CODE>, <DWI>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (<CODE>, <DWI>mode, operands, TARGET_APX_NDD)"
   "#"
   "&& reload_completed"
   [(const_int:DWIH 0)]
 
   DONE;
 }
-[(set_attr "isa" "*,*,apx_ndd,apx_ndd")])
+[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd")])
 
 (define_insn "*<code><mode>_1"
-  [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,r,r,?k")
+  [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,r,r,r,?k")
        (any_or:SWI248
-        (match_operand:SWI248 1 "nonimmediate_operand" "%0,0,rm,r,k")
-        (match_operand:SWI248 2 "<general_operand>" "r<i>,<m>,r<i>,<m>,k")))
+        (match_operand:SWI248 1 "nonimmediate_operand" "%0,0,rm,rjM,r,k")
+        (match_operand:SWI248 2 "<general_operand>" "r<i>,<m>,r,<i>,<m>,k")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
    <logic>{<imodesuffix>}\t{%2, %0|%0, %2}
    <logic>{<imodesuffix>}\t{%2, %0|%0, %2}
    <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
    <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
+   <logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}
    #"
-  [(set_attr "isa" "*,*,apx_ndd,apx_ndd,<kmov_isa>")
-   (set_attr "type" "alu, alu, alu, alu, msklog")
+  [(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,<kmov_isa>")
+   (set_attr "type" "alu, alu, alu, alu, alu, msklog")
    (set_attr "mode" "<MODE>")])
 
 (define_insn_and_split "*notxor<mode>_1"
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*<code>si_1_zext"
-  [(set (match_operand:DI 0 "register_operand" "=r,r,r")
+  [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
        (zero_extend:DI
-        (any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,r")
-                   (match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM"))))
+        (any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r")
+                   (match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
   "@
   <logic>{l}\t{%2, %k0|%k0, %2}
   <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}
+  <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}
   <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "type" "alu")
-   (set_attr "isa" "*,apx_ndd,apx_ndd")
+   (set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd")
    (set_attr "mode" "SI")])
 
 (define_insn "*<code>si_1_zext_imm"
         (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0,rm"))
         (match_operand:DI 2 "x86_64_zext_immediate_operand" "Z,Z")))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
   "@
   <logic>{l}\t{%2, %k0|%k0, %2}
   <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}"
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r")
        (any_or:SWI (match_dup 1) (match_dup 2)))]
   "ix86_match_ccmode (insn, CCNOmode)
-   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
   <logic>{<imodesuffix>}\t{%2, %0|%0, %2}
   <logic>{<imodesuffix>}\t{%2, %0|%0, %2}
    (set (match_operand:DI 0 "register_operand" "=r,r,r")
        (zero_extend:DI (any_or:SI (match_dup 1) (match_dup 2))))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
-   && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
   "@
   <logic>{l}\t{%2, %k0|%k0, %2}
   <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}
    (set (match_operand:DI 0 "register_operand" "=r,r")
        (any_or:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)
-   && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
   "@
   <logic>{l}\t{%2, %k0|%k0, %2}
   <logic>{l}\t{%2, %1, %k0|%k0, %1, %2}"
   [(set (match_operand:SDWIM 0 "nonimmediate_operand")
        (neg:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")))]
   ""
-  "ix86_expand_unary_operator (NEG, <MODE>mode, operands,
-                              TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_unary_operator (NEG, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 (define_insn_and_split "*neg<dwi>2_doubleword"
   [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r")
        (zero_extend:DI
          (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands,
-                                          TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_unary_operator_ok (NEG, SImode, operands, TARGET_APX_NDD)"
   "@
   neg{l}\t%k0
   neg{l}\t{%k1, %k0|%k0, %k1}"
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r")
        (neg:SWI (match_dup 1)))]
   "ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_unary_operator_ok (NEG, <MODE>mode, operands,
-                             TARGET_APX_NDD)"
+   && ix86_unary_operator_ok (NEG, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
    neg{<imodesuffix>}\t%0
    neg{<imodesuffix>}\t{%1, %0|%0, %1}"
        (zero_extend:DI
          (neg:SI (match_dup 1))))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_unary_operator_ok (NEG, SImode, operands,
-                             TARGET_APX_NDD)"
+   && ix86_unary_operator_ok (NEG, SImode, operands, TARGET_APX_NDD)"
   "@
    neg{l}\t%k0
    neg{l}\t{%1, %k0|%k0, %1}"
   [(set (match_operand:SDWIM 0 "nonimmediate_operand")
        (not:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")))]
   ""
-  "ix86_expand_unary_operator (NOT, <MODE>mode, operands,
-                              TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_unary_operator (NOT, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 (define_insn_and_split "*one_cmpl<dwi>2_doubleword"
   [(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r")
   [(set (match_operand:DI 0 "register_operand" "=r,r,?k")
        (zero_extend:DI
          (not:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm,k"))))]
-  "TARGET_64BIT && ix86_unary_operator_ok (NOT, SImode, operands,
-                                          TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_unary_operator_ok (NOT, SImode, operands, TARGET_APX_NDD)"
   "@
    not{l}\t%k0
    not{l}\t{%1, %k0|%k0, %1}
    #"
-  [(set_attr "isa" "x64,apx_ndd,avx512bw_512")
+  [(set_attr "isa" "x64,apx_ndd,avx512bw")
    (set_attr "type" "negnot,negnot,msklog")
    (set_attr "mode" "SI,SI,SI")])
 
    (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r")
        (not:SWI (match_dup 1)))]
   "ix86_match_ccmode (insn, CCNOmode)
-   && ix86_unary_operator_ok (NOT, <MODE>mode, operands,
-                             TARGET_APX_NDD)"
+   && ix86_unary_operator_ok (NOT, <MODE>mode, operands, TARGET_APX_NDD)"
   "#"
   [(set_attr "type" "alu1")
    (set_attr "isa" "*,apx_ndd")
        (ashift:SDWIM (match_operand:SDWIM 1 "<ashl_input_operand>")
                      (match_operand:QI 2 "nonmemory_operand")))]
   ""
-  "ix86_expand_binary_operator (ASHIFT, <MODE>mode, operands,
-                               TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_binary_operator (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 (define_insn_and_split "*ashl<dwi>3_doubleword_mask"
   [(set (match_operand:<DWI> 0 "register_operand")
                              (and:QI (match_dup 2) (const_int 63)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT"
-  "shld{q}\t{%s2%1, %0|%0, %1, %2}"
+  "shld{q}\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ishift")
    (set_attr "prefix_0f" "1")
    (set_attr "mode" "DI")
                              (and:QI (match_dup 3) (const_int 63)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_APX_NDD"
-  "shld{q}\t{%s3%2, %1, %0|%0, %1, %2, %3}"
+  "shld{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "DI")])
 
                              (and:QI (match_dup 2) (const_int 31)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   ""
-  "shld{l}\t{%s2%1, %0|%0, %1, %2}"
+  "shld{l}\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ishift")
    (set_attr "prefix_0f" "1")
    (set_attr "mode" "SI")
                              (and:QI (match_dup 3) (const_int 31)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_APX_NDD"
-  "shld{l}\t{%s3%2, %1, %0|%0, %1, %2, %3}"
+  "shld{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "SI")])
 
        (ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,l,rm,k,rm")
                      (match_operand:QI 2 "nonmemory_operand" "c<S>,M,r,<KS>,c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
                       : "sal{<imodesuffix>}\t{%2, %0|%0, %2}";
     }
 }
-  [(set_attr "isa" "*,*,bmi2,<kmov_isa>,apx_ndd")
+  [(set_attr "isa" "*,*,bmi2,avx512bw,apx_ndd")
    (set (attr "type")
      (cond [(eq_attr "alternative" "1")
              (const_string "lea")
          (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,l,rm,rm")
                     (match_operand:QI 2 "nonmemory_operand" "cI,M,r,cI"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (ASHIFT, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (ASHIFT, SImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
        (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,l,k,rm")
                   (match_operand:QI 2 "nonmemory_operand" "cI,M,Ww,cI")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (ASHIFT, HImode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (ASHIFT, HImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
        (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,l,k,rm")
                   (match_operand:QI 2 "nonmemory_operand" "cI,cI,M,Wb,cI")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (ASHIFT, QImode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (ASHIFT, QImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
        && (TARGET_SHIFT1
            || (TARGET_DOUBLE_WITH_ADD && REG_P (operands[0])))))
    && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
           && (TARGET_SHIFT1
               || TARGET_DOUBLE_WITH_ADD)))
    && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (ASHIFT, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (ASHIFT, SImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
    && !(rtx_equal_p (operands[0], operands[1]))"
   [(set (zero_extract:SWI248
          (match_dup 0) (const_int 8) (const_int 8))
-       (match_dup 1))
+       (zero_extract:SWI248
+         (match_dup 1) (const_int 8) (const_int 8)))
    (parallel
      [(set (zero_extract:SWI248
             (match_dup 0) (const_int 8) (const_int 8))
        (any_shiftrt:SDWIM (match_operand:SDWIM 1 "<shift_operand>")
                           (match_operand:QI 2 "nonmemory_operand")))]
   ""
-  "ix86_expand_binary_operator (<CODE>, <MODE>mode, operands,
-                               TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 ;; Avoid useless masking of count operand.
 (define_insn_and_split "*<insn><mode>3_mask"
                              (and:QI (match_dup 2) (const_int 63)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT"
-  "shrd{q}\t{%s2%1, %0|%0, %1, %2}"
+  "shrd{q}\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ishift")
    (set_attr "prefix_0f" "1")
    (set_attr "mode" "DI")
                              (and:QI (match_dup 3) (const_int 63)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_APX_NDD"
-  "shrd{q}\t{%s3%2, %1, %0|%0, %1, %2, %3}"
+  "shrd{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "DI")])
 
                              (and:QI (match_dup 2) (const_int 31)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   ""
-  "shrd{l}\t{%s2%1, %0|%0, %1, %2}"
+  "shrd{l}\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ishift")
    (set_attr "prefix_0f" "1")
    (set_attr "mode" "SI")
                              (and:QI (match_dup 3) (const_int 31)))) 0)))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_APX_NDD"
-  "shrd{l}\t{%s3%2, %1, %0|%0, %1, %2, %3}"
+  "shrd{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "type" "ishift")
    (set_attr "mode" "SI")])
 
    (clobber (reg:CC FLAGS_REG))]
   "INTVAL (operands[2]) == GET_MODE_BITSIZE (<MODE>mode)-1
    && (TARGET_USE_CLTD || optimize_function_for_size_p (cfun))
-   && ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD)"
   "@
    <cvt_mnemonic>
    sar{<imodesuffix>}\t{%2, %0|%0, %2}
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT && INTVAL (operands[2]) == 31
    && (TARGET_USE_CLTD || optimize_function_for_size_p (cfun))
-   && ix86_binary_operator_ok (ASHIFTRT, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (ASHIFTRT, SImode, operands, TARGET_APX_NDD)"
   "@
    {cltd|cdq}
    sar{l}\t{%2, %k0|%k0, %2}
          (match_operand:SWI48 1 "nonimmediate_operand" "0,rm,rm")
          (match_operand:QI 2 "nonmemory_operand" "c<S>,r,c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
          (match_operand:SWI48 1 "nonimmediate_operand" "0,rm,k,rm")
          (match_operand:QI 2 "nonmemory_operand" "c<S>,r,<KS>,c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (LSHIFTRT, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (LSHIFTRT, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
                       : "shr{<imodesuffix>}\t{%2, %0|%0, %2}";
     }
 }
-  [(set_attr "isa" "*,bmi2,<kmov_isa>,apx_ndd")
+  [(set_attr "isa" "*,bmi2,avx512bw,apx_ndd")
    (set_attr "type" "ishift,ishiftx,msklog,ishift")
    (set (attr "length_immediate")
      (if_then_else
          (any_shiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm,rm")
                          (match_operand:QI 2 "nonmemory_operand" "cI,r,cI"))))
    (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                                           TARGET_APX_NDD)"
+  "TARGET_64BIT
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
          (match_operand:SWI12 1 "nonimmediate_operand" "0, rm")
          (match_operand:QI 2 "nonmemory_operand" "c<S>, c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   if (operands[2] == const1_rtx
          (match_operand:QI 1 "nonimmediate_operand" "0, k, rm")
          (match_operand:QI 2 "nonmemory_operand"    "cI,Wb,cI")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (LSHIFTRT, QImode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (LSHIFTRT, QImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
          (match_operand:HI 1 "nonimmediate_operand" "0, k, rm")
          (match_operand:QI 2 "nonmemory_operand" "cI, Ww, cI")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (LSHIFTRT, HImode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (LSHIFTRT, HImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
     || (operands[2] == const1_rtx
        && TARGET_SHIFT1))
    && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   if (operands[2] == const1_rtx
        || (operands[2] == const1_rtx
           && TARGET_SHIFT1))
    && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (<CODE>, SImode, operands,
-                              TARGET_APX_NDD)"
+   && ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   if (operands[2] == const1_rtx
    && !(rtx_equal_p (operands[0], operands[1]))"
   [(set (zero_extract:SWI248
          (match_dup 0) (const_int 8) (const_int 8))
-       (match_dup 1))
+       (zero_extract:SWI248
+         (match_dup 1) (const_int 8) (const_int 8)))
    (parallel
      [(set (zero_extract:SWI248
             (match_dup 0) (const_int 8) (const_int 8))
  ""
 {
   if (TARGET_64BIT)
-    ix86_expand_binary_operator (<CODE>, DImode, operands,
-                                TARGET_APX_NDD);
+    ix86_expand_binary_operator (<CODE>, DImode, operands, TARGET_APX_NDD);
   else if (const_1_to_31_operand (operands[2], VOIDmode))
     emit_insn (gen_ix86_<insn>di3_doubleword
                (operands[0], operands[1], operands[2]));
        (any_rotate:SWIM124 (match_operand:SWIM124 1 "nonimmediate_operand")
                            (match_operand:QI 2 "nonmemory_operand")))]
   ""
-  "ix86_expand_binary_operator (<CODE>, <MODE>mode, operands,
-                               TARGET_APX_NDD); DONE;")
+{
+  ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD);
+  DONE;
+})
 
 ;; Avoid useless masking of count operand.
 (define_insn_and_split "*<insn><mode>3_mask"
          (match_operand:SWI48 1 "nonimmediate_operand" "0,rm,rm")
          (match_operand:QI 2 "nonmemory_operand" "c<S>,<S>,c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   switch (get_attr_type (insn))
        (any_rotate:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "0,rm")
                          (match_operand:QI 2 "nonmemory_operand" "c<S>,c<S>")))
    (clobber (reg:CC FLAGS_REG))]
-  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands,
-                           TARGET_APX_NDD)"
+  "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)"
 {
   bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD;
   if (operands[2] == const1_rtx
     FAIL;
 })
 
+;; Eliminate redundant compare between set{z,nz} and j{z,nz}:
+;; setz %al; test %al,%al; jz <...> -> setz %al; jnz <...> and
+;; setnz %al, test %al,%al; jz <...> -> setnz %al; jz <...>.
+(define_peephole2
+  [(set (match_operand:QI 0 "nonimmediate_operand")
+       (match_operator:QI 1 "bt_comparison_operator"
+         [(reg:CCZ FLAGS_REG) (const_int 0)]))
+   (set (reg:CCZ FLAGS_REG)
+       (compare:CCZ (match_dup 0) (const_int 0)))
+   (set (pc)
+       (if_then_else (match_operator 2 "bt_comparison_operator"
+                       [(reg:CCZ FLAGS_REG) (const_int 0)])
+                     (match_operand 3)
+                     (pc)))]
+  "peep2_regno_dead_p (3, FLAGS_REG)"
+  [(set (match_dup 0)
+       (match_op_dup 1 [(reg:CCZ FLAGS_REG) (const_int 0)]))
+   (set (pc)
+       (if_then_else (match_dup 2)
+                     (match_dup 3)
+                     (pc)))]
+{
+  if (GET_CODE (operands[1]) == EQ)
+    {
+      operands[2] = shallow_copy_rtx (operands[2]);
+      PUT_CODE (operands[2], reverse_condition (GET_CODE (operands[2])));
+    }
+})
+
 ;; The SSE store flag instructions saves 0 or 0xffffffff to the result.
 ;; subsequent logical operations are used to imitate conditional moves.
 ;; 0xffffffff is NaN, but not in normalized form, so we can't represent
   [(set_attr "prefix" "vex")
    (set_attr "type" "other")])
 
+(define_insn "ldtilecfg"
+  [(unspec_volatile [(match_operand:XI 0 "memory_operand" "m")]
+            UNSPECV_LDTILECFG)]
+  "TARGET_AMX_TILE"
+  "ldtilecfg\t%0"
+  [(set_attr "type" "other")
+   (set_attr "prefix" "maybe_evex")
+   (set_attr "memory" "load")
+   (set_attr "mode" "XI")])
+
+(define_insn "sttilecfg"
+  [(set (match_operand:XI 0 "memory_operand" "=m")
+        (unspec_volatile:XI [(const_int 0)] UNSPECV_STTILECFG))]
+  "TARGET_AMX_TILE"
+  "sttilecfg\t%0"
+  [(set_attr "type" "other")
+   (set_attr "prefix" "maybe_evex")
+   (set_attr "memory" "store")
+   (set_attr "mode" "XI")])
+
 (include "mmx.md")
 (include "sse.md")
 (include "sync.md")