Skip to content

Commit 1f5ad70

Browse files
committedMay 4, 2016
[SelectionDAG] BITREVERSE vector legalization of bit operations (REAPPLIED)
Some vector bit operations are promoted instead of having custom lowering. This patch changes the isOperationLegalOrCustom tests for vector AND/OR operations to use a new TLI helper isOperationLegalOrCustomOrPromote instead, allowing the SSE implementations to stay on the simd unit. Differential Revision: http://reviews.llvm.org/D19805 llvm-svn: 268561
1 parent 75d661a commit 1f5ad70

File tree

3 files changed

+2094
-12530
lines changed

3 files changed

+2094
-12530
lines changed
 

‎llvm/include/llvm/Target/TargetLowering.h

+10
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ class TargetLoweringBase {
600600
getOperationAction(Op, VT) == Promote);
601601
}
602602

603+
/// Return true if the specified operation is legal on this target or can be
604+
/// made legal with custom lowering or using promotion. This is used to help
605+
/// guide high-level lowering decisions.
606+
bool isOperationLegalOrCustomOrPromote(unsigned Op, EVT VT) const {
607+
return (VT == MVT::Other || isTypeLegal(VT)) &&
608+
(getOperationAction(Op, VT) == Legal ||
609+
getOperationAction(Op, VT) == Custom ||
610+
getOperationAction(Op, VT) == Promote);
611+
}
612+
603613
/// Return true if the specified operation is illegal but has a custom lowering
604614
/// on that type. This is used to help guide high-level lowering
605615
/// decisions.

‎llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,8 @@ SDValue VectorLegalizer::ExpandBITREVERSE(SDValue Op) {
894894
// than unrolling and expanding each component.
895895
if (!TLI.isOperationLegalOrCustom(ISD::SHL, VT) ||
896896
!TLI.isOperationLegalOrCustom(ISD::SRL, VT) ||
897-
!TLI.isOperationLegalOrCustom(ISD::AND, VT) ||
898-
!TLI.isOperationLegalOrCustom(ISD::OR, VT))
897+
!TLI.isOperationLegalOrCustomOrPromote(ISD::AND, VT) ||
898+
!TLI.isOperationLegalOrCustomOrPromote(ISD::OR, VT))
899899
return DAG.UnrollVectorOp(Op.getNode());
900900

901901
// Let LegalizeDAG handle this later.

‎llvm/test/CodeGen/X86/vector-bitreverse.ll

+2,082-12,528
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.