summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorAmara Emerson <amara.emerson@arm.com>2017-05-10 15:15:38 +0000
committerAmara Emerson <amara.emerson@arm.com>2017-05-10 15:15:38 +0000
commit816542ceb39ed51c942fa94b5c27041b82fb4d1c (patch)
tree3b34faee402ffd5d71accb479ae5ff4c8df9f54f /llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
parent0381cc74c773fe3e73475b982375fb66cb7ef9f9 (diff)
downloadbcm5719-llvm-816542ceb39ed51c942fa94b5c27041b82fb4d1c.tar.gz
bcm5719-llvm-816542ceb39ed51c942fa94b5c27041b82fb4d1c.zip
[AArch64] Enable use of reduction intrinsics.
The new experimental reduction intrinsics can now be used, so I'm enabling this for AArch64. We will need this for SVE anyway, so it makes sense to do this for NEON reductions as well. The existing code to match shufflevector patterns are replaced with a direct lowering of the reductions to AArch64-specific nodes. Tests updated with the new, simpler, representation. Differential Revision: https://reviews.llvm.org/D32247 llvm-svn: 302678
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 7c6f55c06bc..f41f3ddc819 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -769,3 +769,26 @@ unsigned AArch64TTIImpl::getMinPrefetchStride() {
unsigned AArch64TTIImpl::getMaxPrefetchIterationsAhead() {
return ST->getMaxPrefetchIterationsAhead();
}
+
+bool AArch64TTIImpl::useReductionIntrinsic(unsigned Opcode, Type *Ty,
+ TTI::ReductionFlags Flags) const {
+ assert(isa<VectorType>(Ty) && "Expected Ty to be a vector type");
+ switch (Opcode) {
+ case Instruction::FAdd:
+ case Instruction::FMul:
+ case Instruction::And:
+ case Instruction::Or:
+ case Instruction::Xor:
+ case Instruction::Mul:
+ return false;
+ case Instruction::Add:
+ return Ty->getScalarSizeInBits() * Ty->getVectorNumElements() >= 128;
+ case Instruction::ICmp:
+ return Ty->getScalarSizeInBits() < 64;
+ case Instruction::FCmp:
+ return Flags.NoNaN;
+ default:
+ llvm_unreachable("Unhandled reduction opcode");
+ }
+ return false;
+}
OpenPOWER on IntegriCloud