mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[X86] Do something sensible when an expand load intrinsic is passed a 0 mask.
Previously we just returned undef, but really we should be returning the pass thru input. We also need to make sure we preserve the chain output that the original intrinsic node had to maintain connectivity in the DAG. So we should just return the incoming chain as the output chain. llvm-svn: 333804
This commit is contained in:
parent
ad60f90629
commit
a31261c52e
@ -21641,7 +21641,7 @@ static SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, const X86Subtarget &Subtarget,
|
||||
if (isAllOnesConstant(Mask)) // Return a regular (unmasked) vector load.
|
||||
return DAG.getLoad(VT, dl, Chain, Addr, MemIntr->getMemOperand());
|
||||
if (X86::isZeroNode(Mask))
|
||||
return DAG.getUNDEF(VT);
|
||||
return DAG.getMergeValues({PassThru, Chain}, dl);
|
||||
|
||||
MVT MaskVT = MVT::getVectorVT(MVT::i1, VT.getVectorNumElements());
|
||||
SDValue VMask = getMaskNode(Mask, MaskVT, Subtarget, DAG, dl);
|
||||
|
@ -280,6 +280,15 @@ define <8 x double> @test_expand_load_pd_512(i8* %addr, <8 x double> %data) {
|
||||
ret <8 x double> %res
|
||||
}
|
||||
|
||||
; Make sure we don't crash if you pass 0 to the mask.
|
||||
define <8 x double> @test_zero_mask_expand_load_pd_512(i8* %addr, <8 x double> %data, i8 %mask) {
|
||||
; CHECK-LABEL: test_zero_mask_expand_load_pd_512:
|
||||
; CHECK: ## %bb.0:
|
||||
; CHECK-NEXT: retq
|
||||
%res = call <8 x double> @llvm.x86.avx512.mask.expand.load.pd.512(i8* %addr, <8 x double> %data, i8 0)
|
||||
ret <8 x double> %res
|
||||
}
|
||||
|
||||
define <16 x float> @test_mask_expand_load_ps_512(i8* %addr, <16 x float> %data, i16 %mask) {
|
||||
; CHECK-LABEL: test_mask_expand_load_ps_512:
|
||||
; CHECK: ## %bb.0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user