aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorPhilip Reames <preames@rivosinc.com>2024-08-29 10:14:57 -0700
committerGitHub <noreply@github.com>2024-08-29 10:14:57 -0700
commit2ad782f49ff20d199f31cabc9baa46dba6047d8b (patch)
treeb01fdd6b800338bd110623e3ce7db3a85db39859 /llvm/lib/IR/IntrinsicInst.cpp
parentecd65e64e885b0fd2786ca99ea0c42d692275d91 (diff)
downloadllvm-2ad782f49ff20d199f31cabc9baa46dba6047d8b.zip
llvm-2ad782f49ff20d199f31cabc9baa46dba6047d8b.tar.gz
llvm-2ad782f49ff20d199f31cabc9baa46dba6047d8b.tar.bz2
[VP] Kill VP_PROPERTY_(MEMOP,CASTOP) and simplify _CONSTRAINEDFP [nfc] (#105574)
These lists are quite static. Heavy use of macros is undesirable, and not idiomatic in LLVM, so let's just use the naive switch cases. Note that the first two fields in the CONSTRAINEDFP property were utterly unused (aside from a C++ test). In the same vien as https://github.com/llvm/llvm-project/pull/105551. Once both changes have landed, we'll be left with _BINARYOP which needs a bit of additional untangling, and the actual opcode mappings.
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 966fa62..7ed82c2 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -479,13 +479,16 @@ std::optional<unsigned>
VPIntrinsic::getMemoryPointerParamPos(Intrinsic::ID VPID) {
switch (VPID) {
default:
- break;
-#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
-#define VP_PROPERTY_MEMOP(POINTERPOS, ...) return POINTERPOS;
-#define END_REGISTER_VP_INTRINSIC(VPID) break;
-#include "llvm/IR/VPIntrinsics.def"
+ return std::nullopt;
+ case Intrinsic::vp_store:
+ case Intrinsic::vp_scatter:
+ case Intrinsic::experimental_vp_strided_store:
+ return 1;
+ case Intrinsic::vp_load:
+ case Intrinsic::vp_gather:
+ case Intrinsic::experimental_vp_strided_load:
+ return 0;
}
- return std::nullopt;
}
/// \return The data (payload) operand of this store or scatter.
@@ -499,13 +502,12 @@ Value *VPIntrinsic::getMemoryDataParam() const {
std::optional<unsigned> VPIntrinsic::getMemoryDataParamPos(Intrinsic::ID VPID) {
switch (VPID) {
default:
- break;
-#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
-#define VP_PROPERTY_MEMOP(POINTERPOS, DATAPOS) return DATAPOS;
-#define END_REGISTER_VP_INTRINSIC(VPID) break;
-#include "llvm/IR/VPIntrinsics.def"
+ return std::nullopt;
+ case Intrinsic::vp_store:
+ case Intrinsic::vp_scatter:
+ case Intrinsic::experimental_vp_strided_store:
+ return 0;
}
- return std::nullopt;
}
constexpr bool isVPIntrinsic(Intrinsic::ID ID) {
@@ -589,7 +591,7 @@ VPIntrinsic::getConstrainedIntrinsicIDForVP(Intrinsic::ID ID) {
default:
break;
#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
-#define VP_PROPERTY_CONSTRAINEDFP(HASRND, HASEXCEPT, CID) return Intrinsic::CID;
+#define VP_PROPERTY_CONSTRAINEDFP(CID) return Intrinsic::CID;
#define END_REGISTER_VP_INTRINSIC(VPID) break;
#include "llvm/IR/VPIntrinsics.def"
}
@@ -760,14 +762,9 @@ bool VPReductionIntrinsic::isVPReduction(Intrinsic::ID ID) {
}
bool VPCastIntrinsic::isVPCast(Intrinsic::ID ID) {
- switch (ID) {
- default:
- break;
-#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
-#define VP_PROPERTY_CASTOP return true;
-#define END_REGISTER_VP_INTRINSIC(VPID) break;
-#include "llvm/IR/VPIntrinsics.def"
- }
+ // All of the vp.casts correspond to instructions
+ if (std::optional<unsigned> Opc = getFunctionalOpcodeForVP(ID))
+ return Instruction::isCast(*Opc);
return false;
}