aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorSimon Moll <simon.moll@emea.nec.com>2020-12-09 11:36:30 +0100
committerSimon Moll <simon.moll@emea.nec.com>2020-12-09 11:36:51 +0100
commit3ffbc7935718bd792f2947e90dfcf61e8cc5fb97 (patch)
treeecba8c86fbb533ae822c2b93b3f5e0b556fa6fe5 /llvm/lib/IR/IntrinsicInst.cpp
parentf31704f8ae32a24147fac686f4e922c5c762cfe0 (diff)
downloadllvm-3ffbc7935718bd792f2947e90dfcf61e8cc5fb97.zip
llvm-3ffbc7935718bd792f2947e90dfcf61e8cc5fb97.tar.gz
llvm-3ffbc7935718bd792f2947e90dfcf61e8cc5fb97.tar.bz2
[VP] Build VP SDNodes
Translate VP intrinsics to VP_* SDNodes. The tests check whether a matching vp_* SDNode is emitted. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D91441
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 9f3cc68..3d1ea28 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -208,7 +208,7 @@ Optional<int> VPIntrinsic::GetMaskParamPos(Intrinsic::ID IntrinsicID) {
default:
return None;
-#define REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
+#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
case Intrinsic::VPID: \
return MASKPOS;
#include "llvm/IR/VPIntrinsics.def"
@@ -220,7 +220,7 @@ Optional<int> VPIntrinsic::GetVectorLengthParamPos(Intrinsic::ID IntrinsicID) {
default:
return None;
-#define REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
+#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
case Intrinsic::VPID: \
return VLENPOS;
#include "llvm/IR/VPIntrinsics.def"
@@ -232,7 +232,7 @@ bool VPIntrinsic::IsVPIntrinsic(Intrinsic::ID ID) {
default:
return false;
-#define REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
+#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
case Intrinsic::VPID: \
break;
#include "llvm/IR/VPIntrinsics.def"
@@ -242,15 +242,17 @@ bool VPIntrinsic::IsVPIntrinsic(Intrinsic::ID ID) {
// Equivalent non-predicated opcode
unsigned VPIntrinsic::GetFunctionalOpcodeForVP(Intrinsic::ID ID) {
+ unsigned FunctionalOC = Instruction::Call;
switch (ID) {
default:
- return Instruction::Call;
-
-#define HANDLE_VP_TO_OPC(VPID, OPC) \
- case Intrinsic::VPID: \
- return Instruction::OPC;
+ break;
+#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) case Intrinsic::VPID:
+#define HANDLE_VP_TO_OPC(OPC) FunctionalOC = Instruction::OPC;
+#define END_REGISTER_VP_INTRINSIC(...) break;
#include "llvm/IR/VPIntrinsics.def"
}
+
+ return FunctionalOC;
}
Intrinsic::ID VPIntrinsic::GetForOpcode(unsigned IROPC) {
@@ -258,9 +260,8 @@ Intrinsic::ID VPIntrinsic::GetForOpcode(unsigned IROPC) {
default:
return Intrinsic::not_intrinsic;
-#define HANDLE_VP_TO_OPC(VPID, OPC) \
- case Instruction::OPC: \
- return Intrinsic::VPID;
+#define HANDLE_VP_TO_OPC(OPC) case Instruction::OPC:
+#define END_REGISTER_VP_INTRINSIC(VPID) return Intrinsic::VPID;
#include "llvm/IR/VPIntrinsics.def"
}
}