[llvm] 0ea9cdb - [X86] Fold extract_subvector(fp_to_uint(x)) case to match existing fp_to_sint fold (necessary to fix #83402 on AVX512 targets).
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 04:13:57 PDT 2024
Author: Simon Pilgrim
Date: 2024-08-12T12:13:41+01:00
New Revision: 0ea9cdbf50b6dbd31686c2fefd66e3348eb4a9d6
URL: https://github.com/llvm/llvm-project/commit/0ea9cdbf50b6dbd31686c2fefd66e3348eb4a9d6
DIFF: https://github.com/llvm/llvm-project/commit/0ea9cdbf50b6dbd31686c2fefd66e3348eb4a9d6.diff
LOG: [X86] Fold extract_subvector(fp_to_uint(x)) case to match existing fp_to_sint fold (necessary to fix #83402 on AVX512 targets).
Prep work for #83402
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-half-conversions.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 563de848d6052..2074fac857891 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -57167,8 +57167,10 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
return DAG.getNode(X86ISD::VFPEXT, DL, VT, InVec.getOperand(0));
}
}
- // v4i32 CVTPS2DQ(v4f32).
- if (InOpcode == ISD::FP_TO_SINT && VT == MVT::v4i32) {
+ // v4i32 CVTPS2DQ(v4f32) / CVTPS2UDQ(v4f32).
+ if ((InOpcode == ISD::FP_TO_SINT ||
+ (InOpcode == ISD::FP_TO_UINT && Subtarget.hasVLX())) &&
+ VT == MVT::v4i32) {
SDValue Src = InVec.getOperand(0);
if (Src.getValueType().getScalarType() == MVT::f32)
return DAG.getNode(InOpcode, DL, VT,
diff --git a/llvm/test/CodeGen/X86/vector-half-conversions.ll b/llvm/test/CodeGen/X86/vector-half-conversions.ll
index ca0e9fde38555..e87814ebb1dbe 100644
--- a/llvm/test/CodeGen/X86/vector-half-conversions.ll
+++ b/llvm/test/CodeGen/X86/vector-half-conversions.ll
@@ -5233,8 +5233,7 @@ define <4 x i32> @fptoui_4f16_to_4i32(<4 x half> %a) nounwind {
; AVX512-FASTLANE-LABEL: fptoui_4f16_to_4i32:
; AVX512-FASTLANE: # %bb.0:
; AVX512-FASTLANE-NEXT: vcvtph2ps %xmm0, %ymm0
-; AVX512-FASTLANE-NEXT: vcvttps2udq %ymm0, %ymm0
-; AVX512-FASTLANE-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
+; AVX512-FASTLANE-NEXT: vcvttps2udq %xmm0, %xmm0
; AVX512-FASTLANE-NEXT: vzeroupper
; AVX512-FASTLANE-NEXT: retq
%cvt = fptoui <4 x half> %a to <4 x i32>
More information about the llvm-commits
mailing list