aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorLuke Lau <luke@igalia.com>2023-09-13 13:33:55 +0100
committerGitHub <noreply@github.com>2023-09-13 13:33:55 +0100
commit41eb82f8d12afb7bc4e43534a1a4db0e7980d630 (patch)
tree0f33fb1d0529285129792eecd11a29b0fdcca2be /llvm/lib/IR/IntrinsicInst.cpp
parent05a11f3e6dc234582f18ffeeccec192251cc8b48 (diff)
downloadllvm-41eb82f8d12afb7bc4e43534a1a4db0e7980d630.zip
llvm-41eb82f8d12afb7bc4e43534a1a4db0e7980d630.tar.gz
llvm-41eb82f8d12afb7bc4e43534a1a4db0e7980d630.tar.bz2
[VP] Add method for looking up functional intrinsic ID for VP. NFC (#66190)
This adds a helper method to get the ID of the functionally equivalent intrinsic, similar to the existing getFunctionalOpcodeForVP and getConstrainedIntrinsicIDForVP methods. Not sure if it's notable or not, but I can't find any existing uses of VP_PROPERTY_FUNCTIONAL_INTRINSIC? It could potentially be used in #65706 to scalarize VP intrinsics.
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 61be167..c73634e 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -529,8 +529,22 @@ VPIntrinsic::getFunctionalOpcodeForVP(Intrinsic::ID ID) {
return std::nullopt;
}
+// Equivalent non-predicated intrinsic
+std::optional<Intrinsic::ID>
+VPIntrinsic::getFunctionalIntrinsicIDForVP(Intrinsic::ID ID) {
+ switch (ID) {
+ default:
+ break;
+#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
+#define VP_PROPERTY_FUNCTIONAL_INTRINSIC(INTRIN) return Intrinsic::INTRIN;
+#define END_REGISTER_VP_INTRINSIC(VPID) break;
+#include "llvm/IR/VPIntrinsics.def"
+ }
+ return std::nullopt;
+}
+
// Equivalent non-predicated constrained intrinsic
-std::optional<unsigned>
+std::optional<Intrinsic::ID>
VPIntrinsic::getConstrainedIntrinsicIDForVP(Intrinsic::ID ID) {
switch (ID) {
default: