Skip to content

Commit ab201d0

Browse files
author
git apple-llvm automerger
committed
Merge commit '1c7f40bf8322' from llvm.org/main into next
2 parents 11d006a + 1c7f40b commit ab201d0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45172,6 +45172,18 @@ bool X86TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
4517245172
case X86ISD::Wrapper:
4517345173
case X86ISD::WrapperRIP:
4517445174
return true;
45175+
case X86ISD::PACKSS:
45176+
case X86ISD::PACKUS: {
45177+
APInt DemandedLHS, DemandedRHS;
45178+
getPackDemandedElts(Op.getSimpleValueType(), DemandedElts, DemandedLHS,
45179+
DemandedRHS);
45180+
return (!DemandedLHS ||
45181+
DAG.isGuaranteedNotToBeUndefOrPoison(Op.getOperand(0), DemandedLHS,
45182+
PoisonOnly, Depth + 1)) &&
45183+
(!DemandedRHS ||
45184+
DAG.isGuaranteedNotToBeUndefOrPoison(Op.getOperand(1), DemandedRHS,
45185+
PoisonOnly, Depth + 1));
45186+
}
4517545187
case X86ISD::INSERTPS:
4517645188
case X86ISD::BLENDI:
4517745189
case X86ISD::PSHUFB:
@@ -45242,6 +45254,10 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
4524245254
case X86ISD::BLENDI:
4524345255
case X86ISD::BLENDV:
4524445256
return false;
45257+
// SSE packs.
45258+
case X86ISD::PACKSS:
45259+
case X86ISD::PACKUS:
45260+
return false;
4524545261
// SSE target shuffles.
4524645262
case X86ISD::INSERTPS:
4524745263
case X86ISD::PSHUFB:

llvm/test/CodeGen/X86/combine-pack.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,19 @@ define <8 x i16> @combine_packss_v4i32_signsplat(<4 x i32> %a0, <4 x i32> %a1) {
2626
ret <8 x i16> %signsplat
2727
}
2828

29-
; TODO: Failure to remove unnecessary signsplat through freeze
3029
define <8 x i16> @combine_packss_v4i32_freeze_signsplat(<4 x i32> %a0, <4 x i32> %a1) {
3130
; SSE-LABEL: combine_packss_v4i32_freeze_signsplat:
3231
; SSE: # %bb.0:
3332
; SSE-NEXT: pcmpgtd %xmm1, %xmm0
3433
; SSE-NEXT: pcmpeqd %xmm1, %xmm1
3534
; SSE-NEXT: packssdw %xmm1, %xmm0
36-
; SSE-NEXT: psraw $15, %xmm0
3735
; SSE-NEXT: retq
3836
;
3937
; AVX-LABEL: combine_packss_v4i32_freeze_signsplat:
4038
; AVX: # %bb.0:
4139
; AVX-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
4240
; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
4341
; AVX-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
44-
; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
4542
; AVX-NEXT: retq
4643
%cmp = icmp sgt <4 x i32> %a0, %a1
4744
%ext = sext <4 x i1> %cmp to <4 x i32>

0 commit comments

Comments
 (0)