[llvm] r312879 - adding autoUpgrade support to broadcast[f|i]32x2 intrinsics
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 10 09:30:17 PDT 2017
This change is incomplete. The tests for these intrinsics need to be moved
from avx512dq-intrinsics.ll to avx512dq-intrinsics-upgrade.ll and from
avx512dqvl-intrinsics.ll to avx512dqvl-intrinsics-upgrade.ll.
~Craig
On Sun, Sep 10, 2017 at 1:40 AM, Uriel Korach via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: uriel.k
> Date: Sun Sep 10 01:40:13 2017
> New Revision: 312879
>
> URL: http://llvm.org/viewvc/llvm-project?rev=312879&view=rev
> Log:
> adding autoUpgrade support to broadcast[f|i]32x2 intrinsics
>
> Modified:
> llvm/trunk/include/llvm/IR/IntrinsicsX86.td
> llvm/trunk/lib/IR/AutoUpgrade.cpp
> llvm/trunk/lib/Target/X86/X86IntrinsicsInfo.h
>
> Modified: llvm/trunk/include/llvm/IR/IntrinsicsX86.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/IR/IntrinsicsX86.td?rev=312879&r1=312878&r2=312879&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/IR/IntrinsicsX86.td (original)
> +++ llvm/trunk/include/llvm/IR/IntrinsicsX86.td Sun Sep 10 01:40:13 2017
> @@ -4414,26 +4414,6 @@ let TargetPrefix = "x86" in { // All in
> def int_x86_avx512_vbroadcast_sd_512 :
> Intrinsic<[llvm_v8f64_ty], [llvm_ptr_ty], [IntrReadMem,
> IntrArgMemOnly]>;
>
> - def int_x86_avx512_mask_broadcastf32x2_256 :
> - Intrinsic<[llvm_v8f32_ty],
> - [llvm_v4f32_ty, llvm_v8f32_ty, llvm_i8_ty],
> [IntrNoMem]>;
> -
> - def int_x86_avx512_mask_broadcastf32x2_512 :
> - Intrinsic<[llvm_v16f32_ty],
> - [llvm_v4f32_ty, llvm_v16f32_ty, llvm_i16_ty],
> [IntrNoMem]>;
> -
> - def int_x86_avx512_mask_broadcasti32x2_128 :
> - Intrinsic<[llvm_v4i32_ty],
> - [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
> [IntrNoMem]>;
> -
> - def int_x86_avx512_mask_broadcasti32x2_256 :
> - Intrinsic<[llvm_v8i32_ty],
> - [llvm_v4i32_ty, llvm_v8i32_ty, llvm_i8_ty],
> [IntrNoMem]>;
> -
> - def int_x86_avx512_mask_broadcasti32x2_512 :
> - Intrinsic<[llvm_v16i32_ty],
> - [llvm_v4i32_ty, llvm_v16i32_ty, llvm_i16_ty],
> [IntrNoMem]>;
> -
> def int_x86_avx512_broadcastmw_512 :
> GCCBuiltin<"__builtin_ia32_broadcastmw512">,
> Intrinsic<[llvm_v16i32_ty], [llvm_i16_ty], [IntrNoMem]>;
>
> Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/
> AutoUpgrade.cpp?rev=312879&r1=312878&r2=312879&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
> +++ llvm/trunk/lib/IR/AutoUpgrade.cpp Sun Sep 10 01:40:13 2017
> @@ -72,7 +72,9 @@ static bool ShouldUpgradeX86Intrinsic(Fu
> // like to use this information to remove upgrade code for some older
> // intrinsics. It is currently undecided how we will determine that
> future
> // point.
> - if (Name.startswith("sse2.pcmpeq.") || // Added in 3.1
> + if (Name.startswith("avx512.mask.broadcastf32x2") || // Added in 6.0
> + Name.startswith("avx512.mask.broadcasti32x2") || // Added in 6.0
> + Name.startswith("sse2.pcmpeq.") || // Added in 3.1
> Name.startswith("sse2.pcmpgt.") || // Added in 3.1
> Name.startswith("avx2.pcmpeq.") || // Added in 3.1
> Name.startswith("avx2.pcmpgt.") || // Added in 3.1
> @@ -803,6 +805,20 @@ static Value *upgradeIntMinMax(IRBuilder
> return Res;
> }
>
> +static Value *upgradeBroadcastf32x2(IRBuilder<> &Builder, CallInst &CI) {
> + Value *Op0 = CI.getArgOperand(0);
> + Value *RetArg = CI.getReturnedArgOperand();
> +
> + llvm::VectorType *Ty = RetArg->getType();
> + unsigned NumElts = Ty->getVectorNumElements();
> + uint32_t Indices[NumElts];
> + for(unsigned i = 0; i < NumElts; ++i)
> + Indices[i] = i % 2;
> +
> + Value *Res = Builder.CreateShuffleVector(Op0,UndefValue::get(Ty),
> Indices);
> + return EmitX86Select(Builder, CI.getArgOperand(2), Res,
> CI.getArgOperand(1));
> +}
> +
> static Value *upgradeMaskedCompare(IRBuilder<> &Builder, CallInst &CI,
> unsigned CC, bool Signed) {
> Value *Op0 = CI.getArgOperand(0);
> @@ -1059,6 +1075,9 @@ void llvm::UpgradeIntrinsicCall(CallInst
> Name.startswith("avx2.pmaxs") ||
> Name.startswith("avx512.mask.pmaxs"))) {
> Rep = upgradeIntMinMax(Builder, *CI, ICmpInst::ICMP_SGT);
> + } else if (IsX86 && (Name.startswith("avx512.mask.broadcastf32x2") ||
> + Name.startswith("avx512.mask.broadcasti32x2")))
> {
> + Rep =upgradeBroadcastf32x2(Builder, *CI);
> } else if (IsX86 && (Name == "sse2.pmaxu.b" ||
> Name == "sse41.pmaxuw" ||
> Name == "sse41.pmaxud" ||
>
> Modified: llvm/trunk/lib/Target/X86/X86IntrinsicsInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> X86/X86IntrinsicsInfo.h?rev=312879&r1=312878&r2=312879&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/X86/X86IntrinsicsInfo.h (original)
> +++ llvm/trunk/lib/Target/X86/X86IntrinsicsInfo.h Sun Sep 10 01:40:13 2017
> @@ -478,16 +478,6 @@ static const IntrinsicData IntrinsicsWi
> X86ISD::FADDS_RND, 0),
> X86_INTRINSIC_DATA(avx512_mask_add_ss_round, INTR_TYPE_SCALAR_MASK_RM,
> X86ISD::FADDS_RND, 0),
> - X86_INTRINSIC_DATA(avx512_mask_broadcastf32x2_256, BRCST32x2_TO_VEC,
> - X86ISD::VBROADCAST, 0),
> - X86_INTRINSIC_DATA(avx512_mask_broadcastf32x2_512, BRCST32x2_TO_VEC,
> - X86ISD::VBROADCAST, 0),
> - X86_INTRINSIC_DATA(avx512_mask_broadcasti32x2_128, BRCST32x2_TO_VEC,
> - X86ISD::VBROADCAST, 0),
> - X86_INTRINSIC_DATA(avx512_mask_broadcasti32x2_256, BRCST32x2_TO_VEC,
> - X86ISD::VBROADCAST, 0),
> - X86_INTRINSIC_DATA(avx512_mask_broadcasti32x2_512, BRCST32x2_TO_VEC,
> - X86ISD::VBROADCAST, 0),
> X86_INTRINSIC_DATA(avx512_mask_cmp_pd_128, CMP_MASK_CC, X86ISD::CMPM,
> 0),
> X86_INTRINSIC_DATA(avx512_mask_cmp_pd_256, CMP_MASK_CC, X86ISD::CMPM,
> 0),
> X86_INTRINSIC_DATA(avx512_mask_cmp_pd_512, CMP_MASK_CC, X86ISD::CMPM,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170910/0122ccf7/attachment.html>
More information about the llvm-commits
mailing list