From: Elena Demikhovsky Date: Tue, 8 Apr 2014 07:24:02 +0000 (+0000) Subject: AVX-512: Added fp_to_uint and uint_to_fp patterns. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=dbcb67060590742c039e4fd80a8daf191ef15b1f AVX-512: Added fp_to_uint and uint_to_fp patterns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205754 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 28b49d98336..5426656f256 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1358,9 +1358,11 @@ void X86TargetLowering::resetOperationActions() { setOperationAction(ISD::FP_TO_SINT, MVT::v16i32, Legal); setOperationAction(ISD::FP_TO_UINT, MVT::v16i32, Legal); setOperationAction(ISD::FP_TO_UINT, MVT::v8i32, Legal); + setOperationAction(ISD::FP_TO_UINT, MVT::v4i32, Legal); setOperationAction(ISD::SINT_TO_FP, MVT::v16i32, Legal); setOperationAction(ISD::UINT_TO_FP, MVT::v16i32, Legal); setOperationAction(ISD::UINT_TO_FP, MVT::v8i32, Legal); + setOperationAction(ISD::UINT_TO_FP, MVT::v4i32, Legal); setOperationAction(ISD::FP_ROUND, MVT::v8f32, Legal); setOperationAction(ISD::FP_EXTEND, MVT::v8f32, Legal); diff --git a/lib/Target/X86/X86InstrAVX512.td b/lib/Target/X86/X86InstrAVX512.td index 2c5edf689b9..1bc58fe6630 100644 --- a/lib/Target/X86/X86InstrAVX512.td +++ b/lib/Target/X86/X86InstrAVX512.td @@ -3112,6 +3112,17 @@ def : Pat<(v8i32 (fp_to_uint (v8f32 VR256X:$src1))), (EXTRACT_SUBREG (v16i32 (VCVTTPS2UDQZrr (v16f32 (SUBREG_TO_REG (i32 0), VR256X:$src1, sub_ymm)))), sub_ymm)>; +def : Pat<(v4i32 (fp_to_uint (v4f32 VR128X:$src1))), + (EXTRACT_SUBREG (v16i32 (VCVTTPS2UDQZrr + (v16f32 (SUBREG_TO_REG (i32 0), VR128X:$src1, sub_xmm)))), sub_xmm)>; + +def : Pat<(v8f32 (uint_to_fp (v8i32 VR256X:$src1))), + (EXTRACT_SUBREG (v16f32 (VCVTUDQ2PSZrr + (v16i32 (SUBREG_TO_REG (i32 0), VR256X:$src1, sub_ymm)))), sub_ymm)>; + +def : Pat<(v4f32 (uint_to_fp (v4i32 VR128X:$src1))), + (EXTRACT_SUBREG (v16f32 (VCVTUDQ2PSZrr + (v16i32 (SUBREG_TO_REG (i32 0), VR128X:$src1, sub_xmm)))), sub_xmm)>; def : Pat<(v16f32 (int_x86_avx512_mask_cvtdq2ps_512 (v16i32 VR512:$src), (bc_v16f32 (v16i32 immAllZerosV)), (i16 -1), imm:$rc)), diff --git a/test/CodeGen/X86/avx512-cvt.ll b/test/CodeGen/X86/avx512-cvt.ll index 1d83485adec..2476ea1253e 100644 --- a/test/CodeGen/X86/avx512-cvt.ll +++ b/test/CodeGen/X86/avx512-cvt.ll @@ -24,6 +24,22 @@ define <16 x i32> @fptoui00(<16 x float> %a) nounwind { ret <16 x i32> %b } +; CHECK-LABEL: fptoui_256 +; CHECK: vcvttps2udq +; CHECK: ret +define <8 x i32> @fptoui_256(<8 x float> %a) nounwind { + %b = fptoui <8 x float> %a to <8 x i32> + ret <8 x i32> %b +} + +; CHECK-LABEL: fptoui_128 +; CHECK: vcvttps2udq +; CHECK: ret +define <4 x i32> @fptoui_128(<4 x float> %a) nounwind { + %b = fptoui <4 x float> %a to <4 x i32> + ret <4 x i32> %b +} + ; CHECK-LABEL: fptoui01 ; CHECK: vcvttpd2udq ; CHECK: ret @@ -184,6 +200,22 @@ define <16 x float> @uitof32(<16 x i32> %a) nounwind { ret <16 x float> %b } +; CHECK-LABEL: uitof32_256 +; CHECK: vcvtudq2ps +; CHECK: ret +define <8 x float> @uitof32_256(<8 x i32> %a) nounwind { + %b = uitofp <8 x i32> %a to <8 x float> + ret <8 x float> %b +} + +; CHECK-LABEL: uitof32_128 +; CHECK: vcvtudq2ps +; CHECK: ret +define <4 x float> @uitof32_128(<4 x i32> %a) nounwind { + %b = uitofp <4 x i32> %a to <4 x float> + ret <4 x float> %b +} + ; CHECK-LABEL: @fptosi02 ; CHECK: vcvttss2si {{.*}} encoding: [0x62 ; CHECK: ret