diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -1091,6 +1091,8 @@ unsigned OldShiftOpcode, unsigned NewShiftOpcode, SelectionDAG &DAG) const override; + bool preferScalarizeSplat(unsigned Opc) const override; + bool shouldFoldConstantShiftPairToMask(const SDNode *N, CombineLevel Level) const override; diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -6012,6 +6012,12 @@ return NewShiftOpcode == ISD::SHL; } +bool X86TargetLowering::preferScalarizeSplat(unsigned Opc) const { + if (Opc == ISD::FP_EXTEND) + return false; + return true; +} + bool X86TargetLowering::shouldFoldConstantShiftPairToMask( const SDNode *N, CombineLevel Level) const { assert(((N->getOpcode() == ISD::SHL && diff --git a/llvm/test/CodeGen/X86/prefer-fpext-splat.ll b/llvm/test/CodeGen/X86/prefer-fpext-splat.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/X86/prefer-fpext-splat.ll @@ -0,0 +1,15 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s + +define <4 x double> @prefer(float* %p) { +; CHECK-LABEL: prefer: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vcvtps2pd (%rdi){1to4}, %ymm0 +; CHECK-NEXT: retq +entry: + %0 = load float, float* %p, align 4 + %vecinit.i = insertelement <4 x float> undef, float %0, i64 0 + %vecinit3.i = shufflevector <4 x float> %vecinit.i, <4 x float> poison, <4 x i32> zeroinitializer + %conv.i = fpext <4 x float> %vecinit3.i to <4 x double> + ret <4 x double> %conv.i +}