Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit aa9211b

Browse files
committed
[SelectionDAG] Add support for vector demandedelts in BSWAP opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286582 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 970d6e8 commit aa9211b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,8 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
25752575
break;
25762576
}
25772577
case ISD::BSWAP: {
2578-
computeKnownBits(Op.getOperand(0), KnownZero2, KnownOne2, Depth+1);
2578+
computeKnownBits(Op.getOperand(0), KnownZero2, KnownOne2, DemandedElts,
2579+
Depth + 1);
25792580
KnownZero = KnownZero2.byteSwap();
25802581
KnownOne = KnownOne2.byteSwap();
25812582
break;

test/CodeGen/X86/known-bits-vector.ll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,12 @@ define <4 x i32> @knownbits_mask_srem_shuffle_lshr(<4 x i32> %a0) nounwind {
309309
define <4 x i32> @knownbits_mask_bswap_shuffle_shl(<4 x i32> %a0) nounwind {
310310
; X32-LABEL: knownbits_mask_bswap_shuffle_shl:
311311
; X32: # BB#0:
312-
; X32-NEXT: vpand {{\.LCPI.*}}, %xmm0, %xmm0
313-
; X32-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[3,2,1,0,3,2,1,0,15,14,13,12,15,14,13,12]
314-
; X32-NEXT: vpslld $22, %xmm0, %xmm0
312+
; X32-NEXT: vxorps %xmm0, %xmm0, %xmm0
315313
; X32-NEXT: retl
316314
;
317315
; X64-LABEL: knownbits_mask_bswap_shuffle_shl:
318316
; X64: # BB#0:
319-
; X64-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
320-
; X64-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[3,2,1,0,3,2,1,0,15,14,13,12,15,14,13,12]
321-
; X64-NEXT: vpslld $22, %xmm0, %xmm0
317+
; X64-NEXT: vxorps %xmm0, %xmm0, %xmm0
322318
; X64-NEXT: retq
323319
%1 = and <4 x i32> %a0, <i32 32767, i32 -1, i32 -1, i32 32767>
324320
%2 = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %1)

0 commit comments

Comments
 (0)