diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 45915c10..0506ea9 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -957,6 +957,7 @@ constexpr Intrinsic::ID llvm::getReductionIntrinsicID(RecurKind RK) { } } +// This is the inverse to getReductionForBinop unsigned llvm::getArithmeticReductionInstruction(Intrinsic::ID RdxID) { switch (RdxID) { case Intrinsic::vector_reduce_fadd: @@ -986,6 +987,25 @@ unsigned llvm::getArithmeticReductionInstruction(Intrinsic::ID RdxID) { } } +// This is the inverse to getArithmeticReductionInstruction +Intrinsic::ID llvm::getReductionForBinop(Instruction::BinaryOps Opc) { + switch (Opc) { + default: + break; + case Instruction::Add: + return Intrinsic::vector_reduce_add; + case Instruction::Mul: + return Intrinsic::vector_reduce_mul; + case Instruction::And: + return Intrinsic::vector_reduce_and; + case Instruction::Or: + return Intrinsic::vector_reduce_or; + case Instruction::Xor: + return Intrinsic::vector_reduce_xor; + } + return Intrinsic::not_intrinsic; +} + Intrinsic::ID llvm::getMinMaxReductionIntrinsicOp(Intrinsic::ID RdxID) { switch (RdxID) { default: |