File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -44615,8 +44615,11 @@ bool X86TargetLowering::SimplifyDemandedBitsForTargetNode(
44615
44615
44616
44616
APInt DemandedMask = OriginalDemandedBits << ShAmt;
44617
44617
44618
- // If we just want the sign bit then we don't need to shift it.
44619
- if (OriginalDemandedBits.isSignMask())
44618
+ // If we only want bits that already match the signbit then we don't need
44619
+ // to shift.
44620
+ unsigned NumHiDemandedBits = BitWidth - OriginalDemandedBits.countr_zero();
44621
+ if (TLO.DAG.ComputeNumSignBits(Op0, OriginalDemandedElts, Depth + 1) >=
44622
+ NumHiDemandedBits)
44620
44623
return TLO.CombineTo(Op, Op0);
44621
44624
44622
44625
// fold (VSRAI (VSHLI X, C1), C1) --> X iff NumSignBits(X) > C1
Original file line number Diff line number Diff line change 5
5
6
6
declare <8 x i16 > @llvm.x86.sse2.packssdw.128 (<4 x i32 >, <4 x i32 >)
7
7
8
- ; TODO: Failure to remove unnecessary signsplat
9
8
define <8 x i16 > @combine_packss_v4i32_signsplat (<4 x i32 > %a0 , <4 x i32 > %a1 ) {
10
9
; SSE-LABEL: combine_packss_v4i32_signsplat:
11
10
; SSE: # %bb.0:
12
11
; SSE-NEXT: pcmpgtd %xmm1, %xmm0
13
12
; SSE-NEXT: pcmpeqd %xmm1, %xmm1
14
13
; SSE-NEXT: packssdw %xmm1, %xmm0
15
- ; SSE-NEXT: psraw $15, %xmm0
16
14
; SSE-NEXT: retq
17
15
;
18
16
; AVX-LABEL: combine_packss_v4i32_signsplat:
19
17
; AVX: # %bb.0:
20
18
; AVX-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
21
19
; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
22
20
; AVX-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
23
- ; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
24
21
; AVX-NEXT: retq
25
22
%cmp = icmp sgt <4 x i32 > %a0 , %a1
26
23
%ext = sext <4 x i1 > %cmp to <4 x i32 >
You can’t perform that action at this time.
0 commit comments