Skip to content

Commit

Permalink
Add vector mask testAny and testAll opcodes
Browse files Browse the repository at this point in the history
- the opcodes return true iff at least one element(testAny) or all
  elements(testALL) of the vecror mask are true
- both testAny and testAll opcodes have masked and non-masked
  versions, so add mTestAny, mTestAll, mmTestAny, mmTestAll
  • Loading branch information
gita-omr committed Sep 15, 2022
1 parent b1be89c commit ffe530f
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 0 deletions.
24 changes: 24 additions & 0 deletions compiler/aarch64/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,30 @@ TR::Instruction *tryToGenerateMovImm32ShiftedInstruction(TR::Node *node, TR::Cod
}

// mask evaluators
TR::Register*
OMR::ARM64::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM64::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM64::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM64::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM64::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/aarch64/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *PassThroughEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
24 changes: 24 additions & 0 deletions compiler/arm/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,30 @@ OMR::ARM::TreeEvaluator::compressedRefsEvaluator(TR::Node *node, TR::CodeGenerat
}

// mask evaluators
TR::Register*
OMR::ARM::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::ARM::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/arm/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *compressedRefsEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
64 changes: 64 additions & 0 deletions compiler/il/VectorOperations.enum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,70 @@
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
VECTOR_OPERATION_MACRO(\
/* .operation = */ mAnyTrue, \
/* .name = */ "mAnyTrue", \
/* .properties1 = */ 0, \
/* .properties2 = */ ILProp2::ValueNumberShare | ILProp2::SupportedForPRE, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int32, \
/* .typeProperties = */ ILTypeProp::Size_4 | ILTypeProp::Integer, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = test if any mask element is true */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ mAllTrue, \
/* .name = */ "mAllTrue", \
/* .properties1 = */ 0, \
/* .properties2 = */ ILProp2::ValueNumberShare | ILProp2::SupportedForPRE, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int32, \
/* .typeProperties = */ ILTypeProp::Size_4 | ILTypeProp::Integer, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = test if all mask elements are true */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ mmAnyTrue, \
/* .name = */ "mmAnyTrue", \
/* .properties1 = */ 0, \
/* .properties2 = */ ILProp2::ValueNumberShare | ILProp2::SupportedForPRE, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int32, \
/* .typeProperties = */ ILTypeProp::Size_4 | ILTypeProp::Integer, \
/* .childProperties = */ TWO_SAME_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = test if any mask element is true under mask*/ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ mmAllTrue, \
/* .name = */ "mmAllTrue", \
/* .properties1 = */ 0, \
/* .properties2 = */ ILProp2::ValueNumberShare | ILProp2::SupportedForPRE, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int32, \
/* .typeProperties = */ ILTypeProp::Size_4 | ILTypeProp::Integer, \
/* .childProperties = */ TWO_SAME_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = test if all mask elements are true under mask*/ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ mload, \
/* .name = */ "mload", \
Expand Down
4 changes: 4 additions & 0 deletions compiler/optimizer/OMRSimplifierTable.enum
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@
#define compressedRefsSimplifierHandler anchorSimplifier
#define BBStartSimplifierHandler dftSimplifier
#define BBEndSimplifierHandler endBlockSimplifier
#define mAnyTrueSimplifierHandler dftSimplifier
#define mAllTrueSimplifierHandler dftSimplifier
#define mmAnyTrueSimplifierHandler dftSimplifier
#define mmAllTrueSimplifierHandler dftSimplifier
#define mloadSimplifierHandler directLoadSimplifier
#define mloadiSimplifierHandler indirectLoadSimplifier
#define mstoreSimplifierHandler directStoreSimplifier
Expand Down
4 changes: 4 additions & 0 deletions compiler/optimizer/ValuePropagationTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ TR::Node * constrainLongBitCount(OMR::ValuePropagation *vp, TR::Node *node);
#define compressedRefsVPHandler constrainChildren
#define BBStartVPHandler constrainChildren
#define BBEndVPHandler constrainChildren
#define mAnyTrueVPHandler constrainChildren
#define mAllTrueVPHandler constrainChildren
#define mmAnyTrueVPHandler constrainChildren
#define mmAllTrueVPHandler constrainChildren
#define mloadVPHandler constrainChildren
#define mloadiVPHandler constrainChildren
#define mstoreVPHandler constrainStore
Expand Down
24 changes: 24 additions & 0 deletions compiler/p/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,30 @@ OMR::Power::TreeEvaluator::PassThroughEvaluator(TR::Node *node, TR::CodeGenerato
}

// mask evaluators
TR::Register*
OMR::Power::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return vloadEvaluator(node, cg);
}

TR::Register*
OMR::Power::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return vloadEvaluator(node, cg);
}

TR::Register*
OMR::Power::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return vloadEvaluator(node, cg);
}

TR::Register*
OMR::Power::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return vloadEvaluator(node, cg);
}

TR::Register*
OMR::Power::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/p/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *PassThroughEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
24 changes: 24 additions & 0 deletions compiler/riscv/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,30 @@ OMR::RV::TreeEvaluator::vfmaEvaluator(TR::Node *node, TR::CodeGenerator *cg)
}

// mask evaluators
TR::Register*
OMR::RV::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::RV::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::RV::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::RV::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::RV::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/riscv/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *compressedRefsEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
24 changes: 24 additions & 0 deletions compiler/x/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4527,6 +4527,30 @@ OMR::X86::TreeEvaluator::bitpermuteEvaluator(TR::Node *node, TR::CodeGenerator *


// mask evaluators
TR::Register*
OMR::X86::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::X86::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::X86::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::X86::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::X86::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/x/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *dsqrtEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
24 changes: 24 additions & 0 deletions compiler/z/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,30 @@ OMR::Z::TreeEvaluator::PassThroughEvaluator(TR::Node *node, TR::CodeGenerator *c
}

// mask evaluators
TR::Register*
OMR::Z::TreeEvaluator::mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::Z::TreeEvaluator::mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::Z::TreeEvaluator::mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::Z::TreeEvaluator::mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

TR::Register*
OMR::Z::TreeEvaluator::mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/z/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *PassThroughEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// mask evaluators
static TR::Register *mAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAnyTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mmAllTrueEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mloadiEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mstoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down

0 comments on commit ffe530f

Please sign in to comment.