mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 16:09:57 +00:00
[X86][AVX] Add support for i64 broadcast loads on 32-bit targets
Added 32-bit AVX1/AVX2 broadcast tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257264 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a41a8ee7d
commit
362488a724
@ -8173,6 +8173,8 @@ static SDValue lowerVectorShuffleAsBroadcast(SDLoc DL, MVT VT, SDValue V,
|
||||
DL, VT, V.getOperand(0), BroadcastIdx, Subtarget, DAG))
|
||||
return TruncBroadcast;
|
||||
|
||||
MVT BroadcastVT = VT;
|
||||
|
||||
// Also check the simpler case, where we can directly reuse the scalar.
|
||||
if (V.getOpcode() == ISD::BUILD_VECTOR ||
|
||||
(V.getOpcode() == ISD::SCALAR_TO_VECTOR && BroadcastIdx == 0)) {
|
||||
@ -8183,12 +8185,16 @@ static SDValue lowerVectorShuffleAsBroadcast(SDLoc DL, MVT VT, SDValue V,
|
||||
if (!Subtarget->hasAVX2() && !isShuffleFoldableLoad(V))
|
||||
return SDValue();
|
||||
} else if (MayFoldLoad(V) && !cast<LoadSDNode>(V)->isVolatile()) {
|
||||
// 32-bit targets need to load i64 as a f64 and then bitcast the result.
|
||||
if (!Subtarget->is64Bit() && VT.getScalarType() == MVT::i64)
|
||||
BroadcastVT = MVT::getVectorVT(MVT::f64, VT.getVectorNumElements());
|
||||
|
||||
// If we are broadcasting a load that is only used by the shuffle
|
||||
// then we can reduce the vector load to the broadcasted scalar load.
|
||||
LoadSDNode *Ld = cast<LoadSDNode>(V);
|
||||
SDValue BaseAddr = Ld->getOperand(1);
|
||||
EVT AddrVT = BaseAddr.getValueType();
|
||||
EVT SVT = VT.getScalarType();
|
||||
EVT SVT = BroadcastVT.getScalarType();
|
||||
unsigned Offset = BroadcastIdx * SVT.getStoreSize();
|
||||
SDValue NewAddr = DAG.getNode(
|
||||
ISD::ADD, DL, AddrVT, BaseAddr,
|
||||
@ -8202,7 +8208,8 @@ static SDValue lowerVectorShuffleAsBroadcast(SDLoc DL, MVT VT, SDValue V,
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
return DAG.getNode(X86ISD::VBROADCAST, DL, VT, V);
|
||||
V = DAG.getNode(X86ISD::VBROADCAST, DL, BroadcastVT, V);
|
||||
return DAG.getBitcast(VT, V);
|
||||
}
|
||||
|
||||
// Check for whether we can use INSERTPS to perform the shuffle. We only use
|
||||
|
@ -1,11 +1,24 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx | FileCheck %s --check-prefix=X32
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx | FileCheck %s --check-prefix=X64
|
||||
|
||||
define <4 x i64> @A(i64* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: A:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: A:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: movl (%eax), %ecx
|
||||
; X32-NEXT: movl 4(%eax), %eax
|
||||
; X32-NEXT: vmovd %ecx, %xmm0
|
||||
; X32-NEXT: vpinsrd $1, %eax, %xmm0, %xmm0
|
||||
; X32-NEXT: vpinsrd $2, %ecx, %xmm0, %xmm0
|
||||
; X32-NEXT: vpinsrd $3, %eax, %xmm0, %xmm0
|
||||
; X32-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: A:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load i64, i64* %ptr, align 8
|
||||
%vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0
|
||||
@ -16,10 +29,16 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x i32> @B(i32* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: B:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: B:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: B:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load i32, i32* %ptr, align 4
|
||||
%vecinit.i = insertelement <8 x i32> undef, i32 %q, i32 0
|
||||
@ -30,10 +49,16 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x double> @C(double* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: C:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: C:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastsd (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: C:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load double, double* %ptr, align 8
|
||||
%vecinit.i = insertelement <4 x double> undef, double %q, i32 0
|
||||
@ -44,10 +69,16 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x float> @D(float* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: D:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: D:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: D:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load float, float* %ptr, align 4
|
||||
%vecinit.i = insertelement <8 x float> undef, float %q, i32 0
|
||||
@ -60,10 +91,16 @@ entry:
|
||||
;;;; 128-bit versions
|
||||
|
||||
define <4 x float> @e(float* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: e:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: e:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %xmm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: e:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load float, float* %ptr, align 4
|
||||
%vecinit.i = insertelement <4 x float> undef, float %q, i32 0
|
||||
@ -75,10 +112,15 @@ entry:
|
||||
|
||||
; Don't broadcast constants on pre-AVX2 hardware.
|
||||
define <4 x float> @_e2(float* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: _e2:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovaps {{.*#+}} xmm0 = [-7.812500e-03,-7.812500e-03,-7.812500e-03,-7.812500e-03]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: _e2:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: vmovaps {{.*#+}} xmm0 = [-7.812500e-03,-7.812500e-03,-7.812500e-03,-7.812500e-03]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: _e2:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovaps {{.*#+}} xmm0 = [-7.812500e-03,-7.812500e-03,-7.812500e-03,-7.812500e-03]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%vecinit.i = insertelement <4 x float> undef, float 0xbf80000000000000, i32 0
|
||||
%vecinit2.i = insertelement <4 x float> %vecinit.i, float 0xbf80000000000000, i32 1
|
||||
@ -89,10 +131,16 @@ entry:
|
||||
|
||||
|
||||
define <4 x i32> @F(i32* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: F:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: F:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %xmm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: F:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load i32, i32* %ptr, align 4
|
||||
%vecinit.i = insertelement <4 x i32> undef, i32 %q, i32 0
|
||||
@ -105,10 +153,16 @@ entry:
|
||||
; FIXME: Pointer adjusted broadcasts
|
||||
|
||||
define <4 x i32> @load_splat_4i32_4i32_1111(<4 x i32>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4i32_4i32_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = mem[1,1,1,1]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4i32_4i32_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vpshufd {{.*#+}} xmm0 = mem[1,1,1,1]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4i32_4i32_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vpshufd {{.*#+}} xmm0 = mem[1,1,1,1]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x i32>, <4 x i32>* %ptr
|
||||
%ret = shufflevector <4 x i32> %ld, <4 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
|
||||
@ -116,11 +170,18 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x i32> @load_splat_8i32_4i32_33333333(<4 x i32>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_8i32_4i32_33333333:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vpermilps {{.*#+}} xmm0 = mem[3,3,3,3]
|
||||
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_8i32_4i32_33333333:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vpermilps {{.*#+}} xmm0 = mem[3,3,3,3]
|
||||
; X32-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_8i32_4i32_33333333:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vpermilps {{.*#+}} xmm0 = mem[3,3,3,3]
|
||||
; X64-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x i32>, <4 x i32>* %ptr
|
||||
%ret = shufflevector <4 x i32> %ld, <4 x i32> undef, <8 x i32> <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
|
||||
@ -128,13 +189,22 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x i32> @load_splat_8i32_8i32_55555555(<8 x i32>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_8i32_8i32_55555555:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovaps (%rdi), %ymm0
|
||||
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; CHECK-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,1,1,1]
|
||||
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_8i32_8i32_55555555:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vmovaps (%eax), %ymm0
|
||||
; X32-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; X32-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,1,1,1]
|
||||
; X32-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_8i32_8i32_55555555:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovaps (%rdi), %ymm0
|
||||
; X64-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; X64-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,1,1,1]
|
||||
; X64-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <8 x i32>, <8 x i32>* %ptr
|
||||
%ret = shufflevector <8 x i32> %ld, <8 x i32> undef, <8 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
|
||||
@ -142,10 +212,16 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x float> @load_splat_4f32_4f32_1111(<4 x float>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4f32_4f32_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss 4(%rdi), %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4f32_4f32_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss 4(%eax), %xmm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4f32_4f32_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss 4(%rdi), %xmm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x float>, <4 x float>* %ptr
|
||||
%ret = shufflevector <4 x float> %ld, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
|
||||
@ -153,10 +229,16 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x float> @load_splat_8f32_4f32_33333333(<4 x float>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_8f32_4f32_33333333:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss 12(%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_8f32_4f32_33333333:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss 12(%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_8f32_4f32_33333333:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss 12(%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x float>, <4 x float>* %ptr
|
||||
%ret = shufflevector <4 x float> %ld, <4 x float> undef, <8 x i32> <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
|
||||
@ -164,10 +246,16 @@ entry:
|
||||
}
|
||||
|
||||
define <8 x float> @load_splat_8f32_8f32_55555555(<8 x float>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_8f32_8f32_55555555:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss 20(%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_8f32_8f32_55555555:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss 20(%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_8f32_8f32_55555555:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss 20(%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <8 x float>, <8 x float>* %ptr
|
||||
%ret = shufflevector <8 x float> %ld, <8 x float> undef, <8 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
|
||||
@ -175,10 +263,16 @@ entry:
|
||||
}
|
||||
|
||||
define <2 x i64> @load_splat_2i64_2i64_1111(<2 x i64>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_2i64_2i64_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = mem[2,3,2,3]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_2i64_2i64_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vpshufd {{.*#+}} xmm0 = mem[2,3,2,3]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_2i64_2i64_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vpshufd {{.*#+}} xmm0 = mem[2,3,2,3]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <2 x i64>, <2 x i64>* %ptr
|
||||
%ret = shufflevector <2 x i64> %ld, <2 x i64> undef, <2 x i32> <i32 1, i32 1>
|
||||
@ -186,12 +280,20 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x i64> @load_splat_4i64_2i64_1111(<2 x i64>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4i64_2i64_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovaps (%rdi), %xmm0
|
||||
; CHECK-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4i64_2i64_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vmovaps (%eax), %xmm0
|
||||
; X32-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; X32-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4i64_2i64_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovaps (%rdi), %xmm0
|
||||
; X64-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; X64-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <2 x i64>, <2 x i64>* %ptr
|
||||
%ret = shufflevector <2 x i64> %ld, <2 x i64> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
|
||||
@ -199,13 +301,22 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x i64> @load_splat_4i64_4i64_2222(<4 x i64>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4i64_4i64_2222:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovapd (%rdi), %ymm0
|
||||
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; CHECK-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
|
||||
; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4i64_4i64_2222:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vmovapd (%eax), %ymm0
|
||||
; X32-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; X32-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
|
||||
; X32-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4i64_4i64_2222:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovapd (%rdi), %ymm0
|
||||
; X64-NEXT: vextractf128 $1, %ymm0, %xmm0
|
||||
; X64-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
|
||||
; X64-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x i64>, <4 x i64>* %ptr
|
||||
%ret = shufflevector <4 x i64> %ld, <4 x i64> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
|
||||
@ -213,11 +324,18 @@ entry:
|
||||
}
|
||||
|
||||
define <2 x double> @load_splat_2f64_2f64_1111(<2 x double>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_2f64_2f64_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovaps (%rdi), %xmm0
|
||||
; CHECK-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_2f64_2f64_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vmovaps (%eax), %xmm0
|
||||
; X32-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_2f64_2f64_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovaps (%rdi), %xmm0
|
||||
; X64-NEXT: vmovhlps {{.*#+}} xmm0 = xmm0[1,1]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <2 x double>, <2 x double>* %ptr
|
||||
%ret = shufflevector <2 x double> %ld, <2 x double> undef, <2 x i32> <i32 1, i32 1>
|
||||
@ -225,10 +343,16 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x double> @load_splat_4f64_2f64_1111(<2 x double>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4f64_2f64_1111:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastsd 8(%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4f64_2f64_1111:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastsd 8(%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4f64_2f64_1111:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastsd 8(%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <2 x double>, <2 x double>* %ptr
|
||||
%ret = shufflevector <2 x double> %ld, <2 x double> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
|
||||
@ -236,10 +360,16 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x double> @load_splat_4f64_4f64_2222(<4 x double>* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: load_splat_4f64_4f64_2222:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastsd 16(%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: load_splat_4f64_4f64_2222:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastsd 16(%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: load_splat_4f64_4f64_2222:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastsd 16(%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%ld = load <4 x double>, <4 x double>* %ptr
|
||||
%ret = shufflevector <4 x double> %ld, <4 x double> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
|
||||
@ -249,11 +379,22 @@ entry:
|
||||
; Unsupported vbroadcasts
|
||||
|
||||
define <2 x i64> @G(i64* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: G:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
|
||||
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: G:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: movl (%eax), %ecx
|
||||
; X32-NEXT: movl 4(%eax), %eax
|
||||
; X32-NEXT: vmovd %ecx, %xmm0
|
||||
; X32-NEXT: vpinsrd $1, %eax, %xmm0, %xmm0
|
||||
; X32-NEXT: vpinsrd $2, %ecx, %xmm0, %xmm0
|
||||
; X32-NEXT: vpinsrd $3, %eax, %xmm0, %xmm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: G:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero
|
||||
; X64-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load i64, i64* %ptr, align 8
|
||||
%vecinit.i = insertelement <2 x i64> undef, i64 %q, i32 0
|
||||
@ -262,20 +403,31 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x i32> @H(<4 x i32> %a) {
|
||||
; CHECK-LABEL: H:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: H:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: H:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%x = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
|
||||
ret <4 x i32> %x
|
||||
}
|
||||
|
||||
define <2 x double> @I(double* %ptr) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: I:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0]
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: I:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0]
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: I:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0]
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load double, double* %ptr, align 4
|
||||
%vecinit.i = insertelement <2 x double> undef, double %q, i32 0
|
||||
@ -284,12 +436,21 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x float> @_RR(float* %ptr, i32* %k) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: _RR:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; CHECK-NEXT: movl (%rsi), %eax
|
||||
; CHECK-NEXT: movl %eax, (%rax)
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: _RR:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
||||
; X32-NEXT: vbroadcastss (%ecx), %xmm0
|
||||
; X32-NEXT: movl (%eax), %eax
|
||||
; X32-NEXT: movl %eax, (%eax)
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: _RR:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; X64-NEXT: movl (%rsi), %eax
|
||||
; X64-NEXT: movl %eax, (%rax)
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load float, float* %ptr, align 4
|
||||
%vecinit.i = insertelement <4 x float> undef, float %q, i32 0
|
||||
@ -303,10 +464,16 @@ entry:
|
||||
}
|
||||
|
||||
define <4 x float> @_RR2(float* %ptr, i32* %k) nounwind uwtable readnone ssp {
|
||||
; CHECK-LABEL: _RR2:
|
||||
; CHECK: ## BB#0: ## %entry
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: _RR2:
|
||||
; X32: ## BB#0: ## %entry
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %xmm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: _RR2:
|
||||
; X64: ## BB#0: ## %entry
|
||||
; X64-NEXT: vbroadcastss (%rdi), %xmm0
|
||||
; X64-NEXT: retq
|
||||
entry:
|
||||
%q = load float, float* %ptr, align 4
|
||||
%v = insertelement <4 x float> undef, float %q, i32 0
|
||||
@ -319,10 +486,16 @@ entry:
|
||||
; (via the insertelements).
|
||||
|
||||
define <8 x float> @splat_concat1(float* %p) {
|
||||
; CHECK-LABEL: splat_concat1:
|
||||
; CHECK: ## BB#0:
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: splat_concat1:
|
||||
; X32: ## BB#0:
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: splat_concat1:
|
||||
; X64: ## BB#0:
|
||||
; X64-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
%1 = load float, float* %p, align 4
|
||||
%2 = insertelement <4 x float> undef, float %1, i32 0
|
||||
%3 = insertelement <4 x float> %2, float %1, i32 1
|
||||
@ -333,10 +506,16 @@ define <8 x float> @splat_concat1(float* %p) {
|
||||
}
|
||||
|
||||
define <8 x float> @splat_concat2(float* %p) {
|
||||
; CHECK-LABEL: splat_concat2:
|
||||
; CHECK: ## BB#0:
|
||||
; CHECK-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: splat_concat2:
|
||||
; X32: ## BB#0:
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastss (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: splat_concat2:
|
||||
; X64: ## BB#0:
|
||||
; X64-NEXT: vbroadcastss (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
%1 = load float, float* %p, align 4
|
||||
%2 = insertelement <4 x float> undef, float %1, i32 0
|
||||
%3 = insertelement <4 x float> %2, float %1, i32 1
|
||||
@ -351,10 +530,16 @@ define <8 x float> @splat_concat2(float* %p) {
|
||||
}
|
||||
|
||||
define <4 x double> @splat_concat3(double* %p) {
|
||||
; CHECK-LABEL: splat_concat3:
|
||||
; CHECK: ## BB#0:
|
||||
; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: splat_concat3:
|
||||
; X32: ## BB#0:
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastsd (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: splat_concat3:
|
||||
; X64: ## BB#0:
|
||||
; X64-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
%1 = load double, double* %p, align 8
|
||||
%2 = insertelement <2 x double> undef, double %1, i32 0
|
||||
%3 = insertelement <2 x double> %2, double %1, i32 1
|
||||
@ -363,10 +548,16 @@ define <4 x double> @splat_concat3(double* %p) {
|
||||
}
|
||||
|
||||
define <4 x double> @splat_concat4(double* %p) {
|
||||
; CHECK-LABEL: splat_concat4:
|
||||
; CHECK: ## BB#0:
|
||||
; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; CHECK-NEXT: retq
|
||||
; X32-LABEL: splat_concat4:
|
||||
; X32: ## BB#0:
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: vbroadcastsd (%eax), %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: splat_concat4:
|
||||
; X64: ## BB#0:
|
||||
; X64-NEXT: vbroadcastsd (%rdi), %ymm0
|
||||
; X64-NEXT: retq
|
||||
%1 = load double, double* %p, align 8
|
||||
%2 = insertelement <2 x double> undef, double %1, i32 0
|
||||
%3 = insertelement <2 x double> %2, double %1, i32 1
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user