Index: llvm/lib/Target/X86/X86InstrAVX512.td =================================================================== --- llvm/lib/Target/X86/X86InstrAVX512.td +++ llvm/lib/Target/X86/X86InstrAVX512.td @@ -8489,36 +8489,56 @@ } let Predicates = [HasDQI, NoVLX] in { -def : Pat<(v2i64 (X86any_cvttp2si (v2f64 VR128X:$src1))), +def : Pat<(v2i64 (X86cvttp2si (v2f64 VR128X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPD2QQZrr (v8f64 (INSERT_SUBREG (IMPLICIT_DEF), VR128X:$src1, sub_xmm)))), sub_xmm)>; +def : Pat<(v2i64 (X86strict_cvttp2si (v2f64 VR128X:$src1))), + (EXTRACT_SUBREG (v8i64 (VCVTTPD2QQZrr + (v8f64 (INSERT_SUBREG (AVX512_512_SET0), + VR128X:$src1, sub_xmm)))), sub_xmm)>; + def : Pat<(v4i64 (X86any_cvttp2si (v4f32 VR128X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPS2QQZrr (v8f32 (INSERT_SUBREG (IMPLICIT_DEF), VR128X:$src1, sub_xmm)))), sub_ymm)>; -def : Pat<(v4i64 (X86any_cvttp2si (v4f64 VR256X:$src1))), +def : Pat<(v4i64 (X86cvttp2si (v4f64 VR256X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPD2QQZrr (v8f64 (INSERT_SUBREG (IMPLICIT_DEF), VR256X:$src1, sub_ymm)))), sub_ymm)>; -def : Pat<(v2i64 (X86any_cvttp2ui (v2f64 VR128X:$src1))), +def : Pat<(v4i64 (X86strict_cvttp2si (v4f64 VR256X:$src1))), + (EXTRACT_SUBREG (v8i64 (VCVTTPD2QQZrr + (v8f64 (INSERT_SUBREG (AVX512_512_SET0), + VR256X:$src1, sub_ymm)))), sub_ymm)>; + +def : Pat<(v2i64 (X86cvttp2ui (v2f64 VR128X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPD2UQQZrr (v8f64 (INSERT_SUBREG (IMPLICIT_DEF), VR128X:$src1, sub_xmm)))), sub_xmm)>; +def : Pat<(v2i64 (X86strict_cvttp2ui (v2f64 VR128X:$src1))), + (EXTRACT_SUBREG (v8i64 (VCVTTPD2UQQZrr + (v8f64 (INSERT_SUBREG (AVX512_512_SET0), + VR128X:$src1, sub_xmm)))), sub_xmm)>; + def : Pat<(v4i64 (X86any_cvttp2ui (v4f32 VR128X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPS2UQQZrr (v8f32 (INSERT_SUBREG (IMPLICIT_DEF), VR128X:$src1, sub_xmm)))), sub_ymm)>; -def : Pat<(v4i64 (X86any_cvttp2ui (v4f64 VR256X:$src1))), +def : Pat<(v4i64 (X86cvttp2ui (v4f64 VR256X:$src1))), (EXTRACT_SUBREG (v8i64 (VCVTTPD2UQQZrr (v8f64 (INSERT_SUBREG (IMPLICIT_DEF), VR256X:$src1, sub_ymm)))), sub_ymm)>; +def : Pat<(v4i64 (X86strict_cvttp2ui (v4f64 VR256X:$src1))), + (EXTRACT_SUBREG (v8i64 (VCVTTPD2UQQZrr + (v8f64 (INSERT_SUBREG (AVX512_512_SET0), + VR256X:$src1, sub_ymm)))), sub_ymm)>; + def : Pat<(v4f32 (any_sint_to_fp (v4i64 VR256X:$src1))), (EXTRACT_SUBREG (v8f32 (VCVTQQ2PSZrr (v8i64 (INSERT_SUBREG (IMPLICIT_DEF), Index: llvm/test/CodeGen/X86/vec-strict-fptoint-128.ll =================================================================== --- llvm/test/CodeGen/X86/vec-strict-fptoint-128.ll +++ llvm/test/CodeGen/X86/vec-strict-fptoint-128.ll @@ -152,11 +152,11 @@ ; AVX512VL-64-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm1[0],xmm0[0] ; AVX512VL-64-NEXT: retq ; -; FIXME: This is an unsafe behavior for strict FP ; AVX512DQ-LABEL: strict_vector_fptosi_v2f64_to_v2i64: ; AVX512DQ: # %bb.0: -; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0 -; AVX512DQ-NEXT: vcvttpd2qq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %xmm0, %xmm1 +; AVX512DQ-NEXT: vcvttpd2qq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0 ; AVX512DQ-NEXT: vzeroupper ; AVX512DQ-NEXT: ret{{[l|q]}} @@ -402,11 +402,11 @@ ; AVX512VL-64-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm1[0],xmm0[0] ; AVX512VL-64-NEXT: retq ; -; FIXME: This is an unsafe behavior for strict FP ; AVX512DQ-LABEL: strict_vector_fptoui_v2f64_to_v2i64: ; AVX512DQ: # %bb.0: -; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0 -; AVX512DQ-NEXT: vcvttpd2uqq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %xmm0, %xmm1 +; AVX512DQ-NEXT: vcvttpd2uqq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0 ; AVX512DQ-NEXT: vzeroupper ; AVX512DQ-NEXT: ret{{[l|q]}} Index: llvm/test/CodeGen/X86/vec-strict-fptoint-256.ll =================================================================== --- llvm/test/CodeGen/X86/vec-strict-fptoint-256.ll +++ llvm/test/CodeGen/X86/vec-strict-fptoint-256.ll @@ -139,11 +139,11 @@ ; AVX512VL-64-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0 ; AVX512VL-64-NEXT: retq ; -; FIXME: This is an unsafe behavior for strict FP ; AVX512DQ-LABEL: strict_vector_fptosi_v4f64_to_v4i64: ; AVX512DQ: # %bb.0: -; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0 -; AVX512DQ-NEXT: vcvttpd2qq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %ymm0, %ymm1 +; AVX512DQ-NEXT: vcvttpd2qq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 ; AVX512DQ-NEXT: ret{{[l|q]}} %ret = call <4 x i64> @llvm.experimental.constrained.fptosi.v4i64.v4f64(<4 x double> %a, @@ -402,11 +402,11 @@ ; AVX512VL-64-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0 ; AVX512VL-64-NEXT: retq ; -; FIXME: This is an unsafe behavior for strict FP ; AVX512DQ-LABEL: strict_vector_fptoui_v4f64_to_v4i64: ; AVX512DQ: # %bb.0: -; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0 -; AVX512DQ-NEXT: vcvttpd2uqq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %ymm0, %ymm1 +; AVX512DQ-NEXT: vcvttpd2uqq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 ; AVX512DQ-NEXT: ret{{[l|q]}} %ret = call <4 x i64> @llvm.experimental.constrained.fptoui.v4i64.v4f64(<4 x double> %a, Index: llvm/test/CodeGen/X86/vector-constrained-fp-intrinsics.ll =================================================================== --- llvm/test/CodeGen/X86/vector-constrained-fp-intrinsics.ll +++ llvm/test/CodeGen/X86/vector-constrained-fp-intrinsics.ll @@ -4210,7 +4210,9 @@ ; AVX512DQ-LABEL: constrained_vector_fptosi_v2i64_v2f64: ; AVX512DQ: # %bb.0: # %entry ; AVX512DQ-NEXT: vmovaps {{.*#+}} xmm0 = [4.2100000000000001E+1,4.2200000000000003E+1] -; AVX512DQ-NEXT: vcvttpd2qq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %xmm0, %xmm1 +; AVX512DQ-NEXT: vcvttpd2qq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0 ; AVX512DQ-NEXT: vzeroupper ; AVX512DQ-NEXT: retq @@ -4308,7 +4310,9 @@ ; AVX512DQ-LABEL: constrained_vector_fptosi_v4i64_v4f64: ; AVX512DQ: # %bb.0: # %entry ; AVX512DQ-NEXT: vmovaps {{.*#+}} ymm0 = [4.2100000000000001E+1,4.2200000000000003E+1,4.2299999999999997E+1,4.2399999999999999E+1] -; AVX512DQ-NEXT: vcvttpd2qq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %ymm0, %ymm1 +; AVX512DQ-NEXT: vcvttpd2qq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 ; AVX512DQ-NEXT: retq entry: @@ -5136,7 +5140,9 @@ ; AVX512DQ-LABEL: constrained_vector_fptoui_v2i64_v2f64: ; AVX512DQ: # %bb.0: # %entry ; AVX512DQ-NEXT: vmovaps {{.*#+}} xmm0 = [4.2100000000000001E+1,4.2200000000000003E+1] -; AVX512DQ-NEXT: vcvttpd2uqq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %xmm0, %xmm1 +; AVX512DQ-NEXT: vcvttpd2uqq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0 ; AVX512DQ-NEXT: vzeroupper ; AVX512DQ-NEXT: retq @@ -5406,7 +5412,9 @@ ; AVX512DQ-LABEL: constrained_vector_fptoui_v4i64_v4f64: ; AVX512DQ: # %bb.0: # %entry ; AVX512DQ-NEXT: vmovaps {{.*#+}} ymm0 = [4.2100000000000001E+1,4.2200000000000003E+1,4.2299999999999997E+1,4.2399999999999999E+1] -; AVX512DQ-NEXT: vcvttpd2uqq %zmm0, %zmm0 +; AVX512DQ-NEXT: vxorps %xmm1, %xmm1, %xmm1 +; AVX512DQ-NEXT: vmovaps %ymm0, %ymm1 +; AVX512DQ-NEXT: vcvttpd2uqq %zmm1, %zmm0 ; AVX512DQ-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 ; AVX512DQ-NEXT: retq entry: