llvm.org GIT mirror llvm / e49da9a
Remove 'llvm.x86.avx2.vbroadcasti128' intrinsic. The intrinsic is no longer generated by the front-end. Remove the intrinsic and auto-upgrade it to a vector shuffle. Reviewed by Nadav This is related to rdar://problem/18742778. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231182 91177308-0d34-0410-b5e6-96231b3b80d8 Juergen Ributzka 4 years ago
5 changed file(s) with 30 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
17311731 def int_x86_avx2_vbroadcast_ss_ps_256 :
17321732 GCCBuiltin<"__builtin_ia32_vbroadcastss_ps256">,
17331733 Intrinsic<[llvm_v8f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1734 def int_x86_avx2_vbroadcasti128 :
1735 Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
17361734 def int_x86_avx2_pbroadcastb_128 :
17371735 GCCBuiltin<"__builtin_ia32_pbroadcastb128">,
17381736 Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
178178 Name == "x86.avx2.pblendw" ||
179179 Name == "x86.avx2.pblendd.128" ||
180180 Name == "x86.avx2.pblendd.256" ||
181 Name == "x86.avx2.vbroadcasti128" ||
181182 (Name.startswith("x86.xop.vpcom") && F->arg_size() == 2)) {
182183 NewFn = nullptr;
183184 return true;
552553 for (unsigned I = 0; I < EltNum; ++I)
553554 Rep = Builder.CreateInsertElement(Rep, Load,
554555 ConstantInt::get(I32Ty, I));
556 } else if (Name == "llvm.x86.avx2.vbroadcasti128") {
557 // Replace vbroadcasts with a vector shuffle.
558 Value *Op = Builder.CreatePointerCast(
559 CI->getArgOperand(0),
560 PointerType::getUnqual(VectorType::get(Type::getInt64Ty(C), 2)));
561 Value *Load = Builder.CreateLoad(Op);
562 SmallVector Idxs; // 0, 1, 0, 1.
563 for (unsigned i = 0; i != 4; ++i)
564 Idxs.push_back(Builder.getInt32(i & 1));
565 Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
566 ConstantVector::get(Idxs));
555567 } else if (Name == "llvm.x86.sse2.psll.dq") {
556568 // 128-bit shift left specified in bits.
557569 unsigned Shift = cast(CI->getArgOperand(1))->getZExtValue();
78337833 int_x86_avx2_vbroadcast_sd_pd_256,
78347834 WriteFShuffle256>, VEX_L;
78357835
7836 let Predicates = [HasAVX2] in
7837 def VBROADCASTI128 : avx_broadcast<0x5A, "vbroadcasti128", VR256, i128mem,
7838 int_x86_avx2_vbroadcasti128, WriteLoad>,
7839 VEX_L;
7840
78417836 let Predicates = [HasAVX] in
78427837 def : Pat<(int_x86_avx_vbroadcastf128_ps_256 addr:$src),
78437838 (VBROADCASTF128 addr:$src)>;
639639 }
640640 declare <4 x i64> @llvm.x86.avx2.pmul.dq(<8 x i32>, <8 x i32>) nounwind readnone
641641
642
643 define <4 x i64> @test_x86_avx2_vbroadcasti128(i8* %a0) {
644 ; CHECK: vbroadcasti128
645 %res = call <4 x i64> @llvm.x86.avx2.vbroadcasti128(i8* %a0) ; <<4 x i64>> [#uses=1]
646 ret <4 x i64> %res
647 }
648 declare <4 x i64> @llvm.x86.avx2.vbroadcasti128(i8*) nounwind readonly
649642
650643 define <4 x double> @test_x86_avx2_vbroadcast_sd_pd_256(<2 x double> %a0) {
651644 ; CHECK: vbroadcastsd
0 ; RUN: llc -mattr=+avx2 < %s | FileCheck %s
1
2 ; Check that we properly upgrade the AVX2 vbroadcast intrinsic to IR.
3
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-macosx10.10.0"
6
7 define <4 x i64> @broadcast128(<2 x i64> %src) {
8 CHECK-LABEL: broadcast128
9 CHECK: vinsertf128 $1, %xmm0, %ymm0, %ymm0
10 %1 = alloca <2 x i64>, align 16
11 %2 = bitcast <2 x i64>* %1 to i8*
12 store <2 x i64> %src, <2 x i64>* %1, align 16
13 %3 = call <4 x i64> @llvm.x86.avx2.vbroadcasti128(i8* %2)
14 ret <4 x i64> %3
15 }
16
17 declare <4 x i64> @llvm.x86.avx2.vbroadcasti128(i8*) #1