aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringBase.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-02-13 10:06:25 -0600
committerGitHub <noreply@github.com>2024-02-13 10:06:25 -0600
commit11fcae69dbea4860e20ab799ecca9b0432d7f19d (patch)
tree1d209c1af823c9b2a25b5a75d4c6aee31daf975f /llvm/lib/CodeGen/TargetLoweringBase.cpp
parent381a00de4fdcccd904dac6a0856fb44f12ba0abb (diff)
downloadllvm-11fcae69dbea4860e20ab799ecca9b0432d7f19d.zip
llvm-11fcae69dbea4860e20ab799ecca9b0432d7f19d.tar.gz
llvm-11fcae69dbea4860e20ab799ecca9b0432d7f19d.tar.bz2
[LLVM] Add `__builtin_readsteadycounter` intrinsic and builtin for realtime clocks (#81331)
Summary: This patch adds a new intrinsic and builtin function mirroring the existing `__builtin_readcyclecounter`. The difference is that this implementation targets a separate counter that some targets have which returns a fixed frequency clock that can be used to determine elapsed time, this is different compared to the cycle counter which often has variable frequency. This patch only adds support for the NVPTX and AMDGPU targets. This is done as a new and separate builtin rather than an argument to `readcyclecounter` to avoid needing to change existing code and to make the separation more explicit.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index d8302ba2..dc76692 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -964,6 +964,9 @@ void TargetLoweringBase::initActions() {
// Most targets also ignore the @llvm.readcyclecounter intrinsic.
setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Expand);
+ // Most targets also ignore the @llvm.readsteadycounter intrinsic.
+ setOperationAction(ISD::READSTEADYCOUNTER, MVT::i64, Expand);
+
// ConstantFP nodes default to expand. Targets can either change this to
// Legal, in which case all fp constants are legal, or use isFPImmLegal()
// to optimize expansions for certain constants.