[x86] fold shuffles of h-ops that have an undef operand

If an operand is undef, we can assume it's the same as the
other operand.

llvm-svn: 357644
This commit is contained in:
Sanjay Patel 2019-04-03 22:40:35 +00:00
parent 144a43a2fd
commit c9a012e4ea
2 changed files with 2 additions and 3 deletions

View File

@ -32880,8 +32880,8 @@ static SDValue foldShuffleOfHorizOp(SDNode *N) {
// lanes of each operand as: // lanes of each operand as:
// v4X32: A[0] + A[1] , A[2] + A[3] , B[0] + B[1] , B[2] + B[3] // v4X32: A[0] + A[1] , A[2] + A[3] , B[0] + B[1] , B[2] + B[3]
// ...similarly for v2f64 and v8i16. // ...similarly for v2f64 and v8i16.
// TODO: Handle UNDEF operands. if (!HOp.getOperand(0).isUndef() && !HOp.getOperand(1).isUndef() &&
if (HOp.getOperand(0) != HOp.getOperand(1)) HOp.getOperand(0) != HOp.getOperand(1))
return SDValue(); return SDValue();
// When the operands of a horizontal math op are identical, the low half of // When the operands of a horizontal math op are identical, the low half of

View File

@ -381,7 +381,6 @@ define <4 x double> @hadd_v4f64_scalar_splat(<4 x double> %a) {
; AVX-LABEL: hadd_v4f64_scalar_splat: ; AVX-LABEL: hadd_v4f64_scalar_splat:
; AVX: # %bb.0: ; AVX: # %bb.0:
; AVX-NEXT: vhaddpd %ymm0, %ymm0, %ymm0 ; AVX-NEXT: vhaddpd %ymm0, %ymm0, %ymm0
; AVX-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
; AVX-NEXT: retq ; AVX-NEXT: retq
%a0 = extractelement <4 x double> %a, i32 0 %a0 = extractelement <4 x double> %a, i32 0
%a1 = extractelement <4 x double> %a, i32 1 %a1 = extractelement <4 x double> %a, i32 1