Skip to content

Commit

Permalink
Add mask conversion opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
gita-omr committed Oct 3, 2022
1 parent 3563387 commit 220d4a6
Show file tree
Hide file tree
Showing 16 changed files with 609 additions and 1 deletion.
60 changes: 60 additions & 0 deletions compiler/aarch64/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,66 @@ OMR::ARM64::TreeEvaluator::mRegStoreEvaluator(TR::Node *node, TR::CodeGenerator
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

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

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

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

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

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

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

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

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

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

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

// vector evaluators
TR::Instruction *
OMR::ARM64::TreeEvaluator::vsplatsImmediateHelper(TR::Node *node, TR::CodeGenerator *cg, TR::Node *firstChild, TR::DataType elementType, TR::Register *treg)
Expand Down
11 changes: 11 additions & 0 deletions compiler/aarch64/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *mRegLoadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mRegStoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);

static TR::Register *b2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *s2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *i2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *l2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *v2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2bEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2sEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2iEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2lEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2vEvaluator(TR::Node *node, TR::CodeGenerator *cg);

// vector evaluators
static TR::Register *vabsEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *vaddEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
60 changes: 60 additions & 0 deletions compiler/arm/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,66 @@ OMR::ARM::TreeEvaluator::mRegStoreEvaluator(TR::Node *node, TR::CodeGenerator *c
return TR::TreeEvaluator::unImpOpEvaluator(node, cg);
}

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

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

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

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

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

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

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

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

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

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

// vector evaluators
TR::Register*
OMR::ARM::TreeEvaluator::vnotEvaluator(TR::Node *node, TR::CodeGenerator *cg)
Expand Down
11 changes: 11 additions & 0 deletions compiler/arm/codegen/OMRTreeEvaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,17 @@ class OMR_EXTENSIBLE TreeEvaluator: public OMR::TreeEvaluator
static TR::Register *mRegLoadEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *mRegStoreEvaluator(TR::Node *node, TR::CodeGenerator *cg);

static TR::Register *b2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *s2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *i2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *l2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *v2mEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2bEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2sEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2iEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2lEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *m2vEvaluator(TR::Node *node, TR::CodeGenerator *cg);

static TR::Register *vabsEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *vaddEvaluator(TR::Node *node, TR::CodeGenerator *cg);
static TR::Register *vandEvaluator(TR::Node *node, TR::CodeGenerator *cg);
Expand Down
2 changes: 1 addition & 1 deletion compiler/il/OMRILOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class ILOpCode

return (TR::VectorOperation) ((opcode < (TR::NumScalarIlOps + TR::NumOneVectorTypeOps)) ?
(opcode - TR::NumScalarIlOps) / TR::NumVectorTypes :
(opcode - TR::NumScalarIlOps - TR::NumOneVectorTypeOps) / (TR::NumVectorTypes * TR::NumVectorTypes) + TR::firstTwoTypeVectorOperation - 1);
(opcode - TR::NumScalarIlOps - TR::NumOneVectorTypeOps) / (TR::NumVectorTypes * TR::NumVectorTypes) + TR::firstTwoTypeVectorOperation);
}

/** \brief
Expand Down
162 changes: 162 additions & 0 deletions compiler/il/VectorOperations.enum
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,136 @@ VECTOR_OPERATION_MACRO(\
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = Store mask global register */ \
)
// vector mask conversion opcodes
VECTOR_OPERATION_MACRO(\
/* .operation = */ b2m, \
/* .name = */ "b2m", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::MaskResult, \
/* .childProperties = */ ONE_CHILD(TR::Int8), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert byte into 1-element platform specific vector mask */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ s2m, \
/* .name = */ "s2m", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::MaskResult, \
/* .childProperties = */ ONE_CHILD(TR::Int16), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert short into 2-element platform specific vector mask */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ i2m, \
/* .name = */ "i2m", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::MaskResult, \
/* .childProperties = */ ONE_CHILD(TR::Int32), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert int into 4-element platform specific vector mask */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ l2m, \
/* .name = */ "l2m", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::MaskResult, \
/* .childProperties = */ ONE_CHILD(TR::Int64), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert long into 4-element platform specific vector mask */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ m2b, \
/* .name = */ "m2b", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int8, \
/* .typeProperties = */ ILTypeProp::Size_1 | ILTypeProp::Integer, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert 1-element platform specific vector mask into byte*/ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ m2s, \
/* .name = */ "m2s", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int16, \
/* .typeProperties = */ ILTypeProp::Size_2 | ILTypeProp::Integer, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert 2-element platform specific vector mask into short*/ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ m2i, \
/* .name = */ "m2i", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .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 = convert 4-element platform specific vector mask into int*/ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ m2l, \
/* .name = */ "m2l", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::Int64, \
/* .typeProperties = */ ILTypeProp::Size_8 | ILTypeProp::Integer, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert 4-element platform specific vector mask into long*/ \
)
// vector opcodes
VECTOR_OPERATION_MACRO(\
/* .operation = */ vabs, \
/* .name = */ "vabs", \
Expand Down Expand Up @@ -1480,3 +1610,35 @@ VECTOR_OPERATION_MACRO(\
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert vector elements to a new type (not a noop) */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ v2m, \
/* .name = */ "v2m", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::MaskResult, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert boolean vector into platform specific vector mask with the same number of elements */ \
)
VECTOR_OPERATION_MACRO(\
/* .operation = */ m2v, \
/* .name = */ "m2v", \
/* .properties1 = */ ILProp1::Conversion, \
/* .properties2 = */ ILProp2::ValueNumberShare, \
/* .properties3 = */ 0, \
/* .properties4 = */ 0, \
/* .dataType = */ TR::NoType, \
/* .typeProperties = */ ILTypeProp::VectorResult, \
/* .childProperties = */ ONE_CHILD(ILChildProp::UnspecifiedChildType), \
/* .swapChildrenOperation = */ TR::vBadOperation, \
/* .reverseBranchOperation = */ TR::vBadOperation, \
/* .booleanCompareOpCode = */ TR::BadILOp, \
/* .ifCompareOpCode = */ TR::BadILOp, \
/* .description = convert platform specific vector mask into boolean vector with the same number of elements */ \
)
10 changes: 10 additions & 0 deletions compiler/optimizer/OMRSimplifierTable.enum
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@
#define mstoreiSimplifierHandler indirectStoreSimplifier
#define mRegLoadSimplifierHandler dftSimplifier
#define mRegStoreSimplifierHandler dftSimplifier
#define b2mSimplifierHandler dftSimplifier
#define s2mSimplifierHandler dftSimplifier
#define i2mSimplifierHandler dftSimplifier
#define l2mSimplifierHandler dftSimplifier
#define v2mSimplifierHandler dftSimplifier
#define m2bSimplifierHandler dftSimplifier
#define m2sSimplifierHandler dftSimplifier
#define m2iSimplifierHandler dftSimplifier
#define m2lSimplifierHandler dftSimplifier
#define m2vSimplifierHandler dftSimplifier
#define vnotSimplifierHandler dftSimplifier
#define vsplatsSimplifierHandler dftSimplifier
#define vfmaSimplifierHandler dftSimplifier
Expand Down
10 changes: 10 additions & 0 deletions compiler/optimizer/ValuePropagationTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,16 @@ TR::Node * constrainLongBitCount(OMR::ValuePropagation *vp, TR::Node *node);
#define mstoreiVPHandler constrainStore
#define mRegLoadVPHandler constrainChildren
#define mRegStoreVPHandler constrainChildren
#define b2mVPHandler constrainChildren
#define s2mVPHandler constrainChildren
#define i2mVPHandler constrainChildren
#define l2mVPHandler constrainChildren
#define v2mVPHandler constrainChildren
#define m2bVPHandler constrainChildren
#define m2sVPHandler constrainChildren
#define m2iVPHandler constrainChildren
#define m2lVPHandler constrainChildren
#define m2vVPHandler constrainChildren
#define vnotVPHandler constrainChildren
#define vsplatsVPHandler constrainChildren
#define vfmaVPHandler constrainChildren
Expand Down
Loading

0 comments on commit 220d4a6

Please sign in to comment.