(V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
(V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
+(define_mode_iterator MASK_DWI [P2QI P2HI])
+
+(define_expand "mov<mode>"
+ [(set (match_operand:MASK_DWI 0 "nonimmediate_operand")
+ (match_operand:MASK_DWI 1 "nonimmediate_operand"))]
+ "TARGET_AVX512VP2INTERSECT"
+{
+ if (MEM_P (operands[1]) && MEM_P (operands[2]))
+ operands[1] = force_reg (<MODE>mode, operands[1]);
+})
+
+(define_insn_and_split "*mov<mode>_internal"
+ [(set (match_operand:MASK_DWI 0 "nonimmediate_operand" "=k,o")
+ (match_operand:MASK_DWI 1 "nonimmediate_operand" "ko,k"))]
+ "TARGET_AVX512VP2INTERSECT
+ && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0) (match_dup 1))
+ (set (match_dup 2) (match_dup 3))]
+{
+ split_double_mode (<MODE>mode, &operands[0], 2, &operands[0], &operands[2]);
+})
+
(define_insn "avx512vp2intersect_2intersect<mode>"
[(set (match_operand:P2QI 0 "register_operand" "=k")
(unspec:P2QI
--- /dev/null
+/* PR target/96744 */
+/* { dg-do compile } */
+/* { dg-options "-mavx512vp2intersect -O2" } */
+
+#include<immintrin.h>
+void
+_mm512_2intersect_epi64_cut (__m512i __A, __m512i __B, __mmask8 *__U,
+ __mmask8 *__M)
+{
+ __builtin_ia32_2intersectq512 (__U, __M, (__v8di) __A, (__v8di) __B);
+}
+
+void
+_mm512_2intersect_epi32_cut (__m512i __A, __m512i __B, __mmask16 *__U,
+ __mmask16 *__M)
+{
+ __builtin_ia32_2intersectd512 (__U, __M, (__v16si) __A, (__v16si) __B);
+}
+