Skip to content

Commit

Permalink
AArch64: Implement atomic add and swap codegen support
Browse files Browse the repository at this point in the history
Add support for inlining the atomic intrinsics on aarch64.
- atomicAddSymbol
- atomicFetchAndAddSymbol
- atomicSwapSymbol

Signed-off-by: Akira Saitoh <saiaki@jp.ibm.com>
  • Loading branch information
Akira Saitoh committed Apr 27, 2021
1 parent 3d85fbd commit 8dc482a
Show file tree
Hide file tree
Showing 4 changed files with 418 additions and 5 deletions.
19 changes: 19 additions & 0 deletions compiler/aarch64/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,3 +812,22 @@ TR::Instruction *OMR::ARM64::CodeGenerator::generateDebugCounterBump(TR::Instruc
srm.reclaimScratchRegister(counterReg);
return cursor;
}

bool
OMR::ARM64::CodeGenerator::supportsNonHelper(TR::SymbolReferenceTable::CommonNonhelperSymbol symbol)
{
bool result = false;

switch (symbol)
{
case TR::SymbolReferenceTable::atomicAddSymbol:
case TR::SymbolReferenceTable::atomicFetchAndAddSymbol:
case TR::SymbolReferenceTable::atomicSwapSymbol:
{
result = true;
break;
}
}

return result;
}
18 changes: 18 additions & 0 deletions compiler/aarch64/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,24 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGenerator
*/
static uint32_t registerBitMask(int32_t reg);

/**
* @brief Generates an inlined instruction sequence instead of a direct call
*
* @param[in] node: node
* @param[inout] resultReg: resultReg
*
* @return true if an inlined instruction sequence is generated
*/
bool inlineDirectCall(TR::Node *node, TR::Register *&resultReg);

/**
* @brief Answers if intrinsics for the symbol is supported
*
* @param[in] symbol: symbol
* @return true if intrinsics for the symbol is supported
*/
bool supportsNonHelper(TR::SymbolReferenceTable::CommonNonhelperSymbol symbol);

/**
* @brief Answers whether bit operations are supported or not
* @return true if supported, false otherwise
Expand Down
4 changes: 3 additions & 1 deletion compiler/aarch64/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,9 @@ static bool isImm7OffsetGPRInstruction(uint32_t enc)
static bool isExclusiveMemAccessInstruction(TR::InstOpCode::Mnemonic op)
{
return (op == TR::InstOpCode::ldxrx || op == TR::InstOpCode::ldxrw ||
op == TR::InstOpCode::stxrx || op == TR::InstOpCode::stxrw);
op == TR::InstOpCode::ldaxrx || op == TR::InstOpCode::ldaxrw ||
op == TR::InstOpCode::stxrx || op == TR::InstOpCode::stxrw ||
op == TR::InstOpCode::stlxrx || op == TR::InstOpCode::stlxrw);
}


Expand Down
Loading

0 comments on commit 8dc482a

Please sign in to comment.