;; All integer modes.
(define_mode_iterator SWI1248x [QI HI SI DI])
+;; All integer modes with AVX512BW.
+(define_mode_iterator SWI1248_AVX512BW
+ [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")]
+
;; All integer modes without QImode.
(define_mode_iterator SWI248x [HI SI DI])
(any_logic:SWI1248x (match_dup 1)
(match_dup 2)))])
-;; TODO: It seems to be possible to macroize following
-;; 3 patterns.
-(define_insn "*k<logic>qi"
- [(set (match_operand:QI 0 "mask_reg_operand" "=k")
- (any_logic:QI (match_operand:QI 1 "mask_reg_operand" "k")
- (match_operand:QI 2 "mask_reg_operand" "k")))]
- "TARGET_AVX512F"
-{
- return TARGET_AVX512DQ ? "k<logic>b\t{%2, %1, %0|%0, %1, %2}"
- : "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
-}
- [(set_attr "mode" "QI")
- (set_attr "type" "msklog")
- (set_attr "prefix" "vex")])
-
-(define_insn "*k<logic>hi"
- [(set (match_operand:HI 0 "mask_reg_operand" "=k")
- (any_logic:HI (match_operand:HI 1 "mask_reg_operand" "k")
- (match_operand:HI 2 "mask_reg_operand" "k")))]
- "TARGET_AVX512F"
- "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
- [(set_attr "mode" "HI")
- (set_attr "type" "msklog")
- (set_attr "prefix" "vex")])
-
(define_insn "*k<logic><mode>"
- [(set (match_operand:SWI48x 0 "mask_reg_operand" "=k")
- (any_logic:SWI48x (match_operand:SWI48x 1 "mask_reg_operand" "k")
- (match_operand:SWI48x 2 "mask_reg_operand" "k")))]
- "TARGET_AVX512BW"
- "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
+ [(set (match_operand:SWI1248_AVX512BW 0 "mask_reg_operand" "=k")
+ (any_logic:SWI1248_AVX512BW (match_operand:SWI1248_AVX512BW 1 "mask_reg_operand" "k")
+ (match_operand:SWI1248_AVX512BW 2 "mask_reg_operand" "k")))]
+ "TARGET_AVX512F"
+ {
+ if (!TARGET_AVX512DQ && <MODE>mode == QImode)
+ return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
+ else
+ return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
+ }
[(set_attr "mode" "<MODE>")
(set_attr "type" "msklog")
(set_attr "prefix" "vex")])