Skip to content

Commit

Permalink
Merge pull request #7112 from Spencer-Comin/split-constrained-tx
Browse files Browse the repository at this point in the history
Z: Split flag for transactional execution facility
  • Loading branch information
0xdaryl committed Sep 29, 2023
2 parents c9cc0fe + 055cd7c commit 366c6e8
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 58 deletions.
2 changes: 1 addition & 1 deletion compiler/z/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ OMR::Z::CodeGenerator::initialize()

if (comp->target().cpu.isAtLeast(OMR_PROCESSOR_S390_ZEC12))
{
if (comp->target().cpu.supportsFeature(OMR_FEATURE_S390_TE) && !comp->getOption(TR_DisableTM))
if (comp->target().cpu.supportsTransactionalMemoryInstructions() && !comp->getOption(TR_DisableTM))
cg->setSupportsTM();
}

Expand Down
42 changes: 33 additions & 9 deletions compiler/z/env/OMRCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ OMR::Z::CPU::detect(OMRPortLibrary * const omrPortLib)

if (processorDescription.processor < OMR_PROCESSOR_S390_ZEC12)
{
omrsysinfo_processor_set_feature(&processorDescription, OMR_FEATURE_S390_TE, FALSE);
omrsysinfo_processor_set_feature(&processorDescription, OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY, FALSE);
omrsysinfo_processor_set_feature(&processorDescription, OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY, FALSE);
omrsysinfo_processor_set_feature(&processorDescription, OMR_FEATURE_S390_RI, FALSE);
}

Expand Down Expand Up @@ -168,9 +169,11 @@ OMR::Z::CPU::supportsFeatureOldAPI(uint32_t feature)
case OMR_FEATURE_S390_FPE:
supported = self()->getSupportsFloatingPointExtensionFacility();
break;
case OMR_FEATURE_S390_TE:
supported = self()->getSupportsTransactionalMemoryFacility();
case OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY:
supported = self()->getSupportsConstrainedTransactionalExecutionFacility();
break;
case OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY:
supported = self()->getSupportsTransactionalExecutionFacility();
case OMR_FEATURE_S390_RI:
supported = self()->getSupportsRuntimeInstrumentationFacility();
break;
Expand Down Expand Up @@ -345,28 +348,49 @@ OMR::Z::CPU::setSupportsFloatingPointExtensionFacility(bool value)
}

bool
OMR::Z::CPU::getSupportsTransactionalMemoryFacility()
OMR::Z::CPU::getSupportsTransactionalExecutionFacility()
{
return _flags.testAny(S390SupportsTM);
return _flags.testAny(OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY);
}

bool
OMR::Z::CPU::supportsTransactionalMemoryInstructions()
{
return self()->supportsFeature(OMR_FEATURE_S390_TE);
return self()->supportsFeature(OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY);
}


bool
OMR::Z::CPU::setSupportsTransactionalMemoryFacility(bool value)
OMR::Z::CPU::setSupportsTransactionalExecutionFacility(bool value)
{
if (value)
{
_flags.set(S390SupportsTM);
_flags.set(OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY);
}
else
{
_flags.reset(S390SupportsTM);
_flags.reset(OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY);
}

return value;
}

bool
OMR::Z::CPU::getSupportsConstrainedTransactionalExecutionFacility()
{
return _flags.testAny(OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY);
}

bool
OMR::Z::CPU::setSupportsConstrainedTransactionalExecutionFacility(bool value)
{
if (value)
{
_flags.set(OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY);
}
else
{
_flags.reset(OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY);
}

return value;
Expand Down
75 changes: 44 additions & 31 deletions compiler/z/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
bool getSupportsHardwareSQRT();

bool hasPopulationCountInstruction();

/** \brief
* Determines whether the High-Word facility is available on the current processor.
*/
Expand All @@ -95,91 +95,104 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
* Determines whether the High-Word facility is available (if \c true) or not (if \c false).
*/
bool setSupportsHighWordFacility(bool value);

/** \brief
* Determines whether the Decimal Floating Point (DFP) facility is available on the current processor.
*/
bool getSupportsDecimalFloatingPointFacility();

/** \brief
* Determines whether the Decimal Floating Point (DFP) facility is available on the current processor.
*
* \param value
* Determines whether the Decimal Floating Point facility is available (if \c true) or not (if \c false).
*/
bool setSupportsDecimalFloatingPointFacility(bool value);

/** \brief
* Determines whether the Floating Point Extension (FPE) facility is available on the current processor.
*/
bool getSupportsFloatingPointExtensionFacility();

/** \brief
* Determines whether the Floating Point Extension (FPE) facility is available on the current processor.
*
* \param value
* Determines whether the Floating Point Extension facility is available (if \c true) or not (if \c false).
*/
bool setSupportsFloatingPointExtensionFacility(bool value);

/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
* Determines whether the Transactional Execution (TX) facility is available on the current processor.
*/
bool getSupportsTransactionalMemoryFacility();
bool getSupportsTransactionalExecutionFacility();

/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
* Alias of supportsFeature(OMR_FEATURE_S390_TE) as a platform agnostic query.
* Determines whether the Transactional Execution (TX) facility is available on the current processor.
* Alias of supportsFeature(OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY) as a platform agnostic query.
*/
bool supportsTransactionalMemoryInstructions();


/** \brief
* Determines whether the Transactional Execution (TX) facility is available on the current processor.
*
* \param value
* Determines whether the Transactional Execution facility is available (if \c true) or not (if \c false).
*/
bool setSupportsTransactionalExecutionFacility(bool value);

/** \brief
* Determines whether the Transactional Memory (TM) facility is available on the current processor.
* Determines whether the Constrained Transactional Execution (TXC) facility is available on the current processor.
*/
bool getSupportsConstrainedTransactionalExecutionFacility();

/** \brief
* Determines whether the Constrained Transactional Execution (TXC) facility is available on the current processor.
*
* \param value
* Determines whether the Transactional Memory facility is available (if \c true) or not (if \c false).
* Determines whether the Constrained Transactional Execution facility is available (if \c true) or not (if \c false).
*/
bool setSupportsTransactionalMemoryFacility(bool value);
bool setSupportsConstrainedTransactionalExecutionFacility(bool value);

/** \brief
* Determines whether the Runtime Instrumentation (RI) facility is available on the current processor.
*/
bool getSupportsRuntimeInstrumentationFacility();

/** \brief
* Determines whether the Runtime Instrumentation (RI) facility is available on the current processor.
*
* \param value
* Determines whether the Runtime Instrumentation facility is available (if \c true) or not (if \c false).
*/
bool setSupportsRuntimeInstrumentationFacility(bool value);

/** \brief
* Determines whether the Vector facility is available on the current processor.
*/
bool getSupportsVectorFacility();

/** \brief
* Determines whether the Vector facility is available on the current processor.
*
* \param value
* Determines whether the Vector facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorFacility(bool value);

/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*/
bool getSupportsVectorPackedDecimalFacility();

/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*
* \param value
* Determines whether the Vector Packed Decimal facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorPackedDecimalFacility(bool value);

/** \brief
* Determines whether the Miscellaneous Instruction Extensions 2 (MIE2) facility is available on the current
* processor.
Expand All @@ -202,22 +215,22 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
* processor.
*/
bool getSupportsMiscellaneousInstructionExtensions3Facility();

/** \brief
* Determines whether the Miscellaneous Instruction Extensions 3 (MIE3) facility is available on the current
* processor.
*
* \param value
* Determines whether the Miscellaneous Instruction Extensions 3 facility is available (if \c true) or not (if
* Determines whether the Miscellaneous Instruction Extensions 3 facility is available (if \c true) or not (if
* \c false).
*/
bool setSupportsMiscellaneousInstructionExtensions3Facility(bool value);

/** \brief
* Determines whether the Vector Enhancement 2 facility is available on the current processor.
*/
bool getSupportsVectorFacilityEnhancement2();

/** \brief
* Determines whether the Vector Enhancement 2 facility is available on the current processor.
*
Expand All @@ -230,41 +243,41 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
* Determines whether the Vector Enhancement 1 facility is available on the current processor.
*/
bool getSupportsVectorFacilityEnhancement1();

/** \brief
* Determines whether the Vector Enhancement 1 facility is available on the current processor.
*
* \param value
* Determines whether the Vector Enhancement 1 facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorFacilityEnhancement1(bool value);

/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*/
bool getSupportsVectorPackedDecimalEnhancementFacility();

/** \brief
* Determines whether the Vector Packed Decimal facility is available on the current processor.
*
* \param value
* Determines whether the Vector Packed Decimal facility is available (if \c true) or not (if \c false).
*/
bool setSupportsVectorPackedDecimalEnhancementFacility(bool value);

/** \brief
* Determines whether the Guarded Storage (GS) facility is available on the current processor.
*/
bool getSupportsGuardedStorageFacility();

/** \brief
* Determines whether the Guarded Storage (GS) facility is available on the current processor.
*
* \param value
* Determines whether the Guarded Storage facility is available (if \c true) or not (if \c false).
*/
bool setSupportsGuardedStorageFacility(bool value);

/**
* \brief Determines whether 32bit integer rotate is available
*
Expand Down
8 changes: 6 additions & 2 deletions include_core/omrport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,6 @@ typedef struct OMRProcessorDesc {
#define OMR_FEATURE_S390_MSA 3 /* STFLE bit 17 */
#define OMR_FEATURE_S390_DFP 6 /* STFLE bit 42 & 44 */
#define OMR_FEATURE_S390_HPAGE 7
#define OMR_FEATURE_S390_TE 10 /* STFLE bit 50 & 73 */
#define OMR_FEATURE_S390_MSA_EXTENSION3 11 /* STFLE bit 76 */
#define OMR_FEATURE_S390_MSA_EXTENSION4 12 /* STFLE bit 77 */

Expand Down Expand Up @@ -1571,6 +1570,11 @@ typedef struct OMRProcessorDesc {
/* STFLE bit 49 - Miscellaneous-instruction-extension facility */
#define OMR_FEATURE_S390_MISCELLANEOUS_INSTRUCTION_EXTENSION 49

/* STFLE bit 50 - Constrained transactional-execution facility */
#define OMR_FEATURE_S390_CONSTRAINED_TRANSACTIONAL_EXECUTION_FACILITY 50
/* STFLE bit 73 - Transactional-execution facility */
#define OMR_FEATURE_S390_TRANSACTIONAL_EXECUTION_FACILITY 73

/* z13 facilities */

/* STFLE bit 53 - Load/store-on-condition facility 2 */
Expand Down Expand Up @@ -1610,7 +1614,7 @@ typedef struct OMRProcessorDesc {

/* z15 facilities */

/* STFLE bit 61 - Miscellaneous-instruction-extensions facility 3 */
/* STFLE bit 61 - Miscellaneous-instruction-extensions facility 3 */
#define OMR_FEATURE_S390_MISCELLANEOUS_INSTRUCTION_EXTENSION_3 61

/* STFLE bit 148 - Vector enhancements facility 2 */
Expand Down
Loading

0 comments on commit 366c6e8

Please sign in to comment.