<div dir="ltr">FYI, this appears to have broken Halide codegen. We're seeing crashes:<div><br></div><div>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">PC: @ <span class="gmail-Apple-converted-space"> </span>0x55573e53ff04<span class="gmail-Apple-converted-space"> </span>(unknown)<span class="gmail-Apple-converted-space"> </span>llvm::EVT::getExtendedSizeInBits()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573ef6057f <span class="gmail-Apple-converted-space"> </span>1664<span class="gmail-Apple-converted-space"> </span>FailureSignalHandler()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x7f1d375ca9a0<span class="gmail-Apple-converted-space"> </span>1273613376<span class="gmail-Apple-converted-space"> </span>(unknown)</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd636f9 <span class="gmail-Apple-converted-space"> </span>5104<span class="gmail-Apple-converted-space"> </span>combineX86ShufflesConstants()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd62fad <span class="gmail-Apple-converted-space"> </span>1456<span class="gmail-Apple-converted-space"> </span>combineX86ShufflesRecursively()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd62f51 <span class="gmail-Apple-converted-space"> </span>1504<span class="gmail-Apple-converted-space"> </span>combineX86ShufflesRecursively()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd62f51 <span class="gmail-Apple-converted-space"> </span>1504<span class="gmail-Apple-converted-space"> </span>combineX86ShufflesRecursively()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd23fd5 <span class="gmail-Apple-converted-space"> </span>1968<span class="gmail-Apple-converted-space"> </span>combineVectorPack()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573dd05771 <span class="gmail-Apple-converted-space"> </span>1216<span class="gmail-Apple-converted-space"> </span>llvm::X86TargetLowering::PerformDAGCombine()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e28bfc1<span class="gmail-Apple-converted-space"> </span>352<span class="gmail-Apple-converted-space"> </span>(anonymous namespace)::DAGCombiner::combine()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e28a512 <span class="gmail-Apple-converted-space"> </span>1424<span class="gmail-Apple-converted-space"> </span>llvm::SelectionDAG::Combine()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e39bd6b<span class="gmail-Apple-converted-space"> </span>512<span class="gmail-Apple-converted-space"> </span>llvm::SelectionDAGISel::CodeGenAndEmitDAG()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e39ab46<span class="gmail-Apple-converted-space"> </span>896<span class="gmail-Apple-converted-space"> </span>llvm::SelectionDAGISel::SelectAllBasicBlocks()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e397ab6<span class="gmail-Apple-converted-space"> </span>208<span class="gmail-Apple-converted-space"> </span>llvm::SelectionDAGISel::runOnMachineFunction()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573ddc3801 <span class="gmail-Apple-converted-space"> </span>32<span class="gmail-Apple-converted-space"> </span>(anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573e18d14b <span class="gmail-Apple-converted-space"> </span>1024<span class="gmail-Apple-converted-space"> </span>llvm::MachineFunctionPass::runOnFunction()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573ebf9c1c<span class="gmail-Apple-converted-space"> </span>192<span class="gmail-Apple-converted-space"> </span>llvm::FPPassManager::runOnFunction()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573ebf9ed3 <span class="gmail-Apple-converted-space"> </span>48<span class="gmail-Apple-converted-space"> </span>llvm::FPPassManager::runOnModule()</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>@ <span class="gmail-Apple-converted-space"> </span>0x55573ebfa3a9<span class="gmail-Apple-converted-space"> </span>352<span class="gmail-Apple-converted-space"> </span>llvm::legacy::PassManagerImpl::run()</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p>Working to minimize a test-case.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 3, 2019 at 8:10 AM Simon Pilgrim via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: rksimon<br>
Date: Sun Feb 3 08:10:18 2019<br>
New Revision: 352997<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=352997&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=352997&view=rev</a><br>
Log:<br>
[X86][AVX] Support shuffle combining for VPMOVZX with smaller vector sources<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=352997&r1=352996&r2=352997&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=352997&r1=352996&r2=352997&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Feb 3 08:10:18 2019<br>
@@ -6775,13 +6775,21 @@ static bool getFauxShuffleMask(SDValue N<br>
}<br>
case ISD::ZERO_EXTEND_VECTOR_INREG:<br>
case ISD::ZERO_EXTEND: {<br>
- // TODO - add support for VPMOVZX with smaller input vector types.<br>
SDValue Src = N.getOperand(0);<br>
MVT SrcVT = Src.getSimpleValueType();<br>
- if (NumSizeInBits != SrcVT.getSizeInBits())<br>
- break;<br>
- DecodeZeroExtendMask(SrcVT.getScalarSizeInBits(), NumBitsPerElt, NumElts,<br>
- Mask);<br>
+ unsigned NumSrcBitsPerElt = SrcVT.getScalarSizeInBits();<br>
+ DecodeZeroExtendMask(NumSrcBitsPerElt, NumBitsPerElt, NumElts, Mask);<br>
+<br>
+ if (NumSizeInBits != SrcVT.getSizeInBits()) {<br>
+ assert((NumSizeInBits % SrcVT.getSizeInBits()) == 0 &&<br>
+ "Illegal zero-extension type");<br>
+ SrcVT = MVT::getVectorVT(SrcVT.getScalarType(),<br>
+ NumSizeInBits / NumSrcBitsPerElt);<br>
+ Src = DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(N), SrcVT,<br>
+ DAG.getUNDEF(SrcVT), Src,<br>
+ DAG.getIntPtrConstant(0, SDLoc(N)));<br>
+ }<br>
+<br>
Ops.push_back(Src);<br>
return true;<br>
}<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll?rev=352997&r1=352996&r2=352997&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll?rev=352997&r1=352996&r2=352997&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/vector-shuffle-256-v8.ll Sun Feb 3 08:10:18 2019<br>
@@ -1526,9 +1526,8 @@ define <8 x i32> @shuffle_v8i32_08192a3b<br>
;<br>
; AVX512VL-LABEL: shuffle_v8i32_08192a3b:<br>
; AVX512VL: # %bb.0:<br>
-; AVX512VL-NEXT: vpmovzxdq {{.*#+}} ymm2 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero<br>
-; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm0 = [0,8,2,9,4,10,6,11]<br>
-; AVX512VL-NEXT: vpermi2d %ymm1, %ymm2, %ymm0<br>
+; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,8,1,9,2,10,3,11]<br>
+; AVX512VL-NEXT: vpermt2d %ymm1, %ymm2, %ymm0<br>
; AVX512VL-NEXT: retq<br>
%shuffle = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11><br>
ret <8 x i32> %shuffle<br>
@@ -1572,11 +1571,23 @@ define <8 x i32> @shuffle_v8i32_091b2d3f<br>
; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7]<br>
; AVX1-NEXT: retq<br>
;<br>
-; AVX2OR512VL-LABEL: shuffle_v8i32_091b2d3f:<br>
-; AVX2OR512VL: # %bb.0:<br>
-; AVX2OR512VL-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero<br>
-; AVX2OR512VL-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7]<br>
-; AVX2OR512VL-NEXT: retq<br>
+; AVX2-LABEL: shuffle_v8i32_091b2d3f:<br>
+; AVX2: # %bb.0:<br>
+; AVX2-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero<br>
+; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7]<br>
+; AVX2-NEXT: retq<br>
+;<br>
+; AVX512VL-SLOW-LABEL: shuffle_v8i32_091b2d3f:<br>
+; AVX512VL-SLOW: # %bb.0:<br>
+; AVX512VL-SLOW-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero<br>
+; AVX512VL-SLOW-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7]<br>
+; AVX512VL-SLOW-NEXT: retq<br>
+;<br>
+; AVX512VL-FAST-LABEL: shuffle_v8i32_091b2d3f:<br>
+; AVX512VL-FAST: # %bb.0:<br>
+; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [0,9,1,11,2,13,3,15]<br>
+; AVX512VL-FAST-NEXT: vpermt2d %ymm1, %ymm2, %ymm0<br>
+; AVX512VL-FAST-NEXT: retq<br>
%shuffle = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 11, i32 2, i32 13, i32 3, i32 15><br>
ret <8 x i32> %shuffle<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>