summaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-10-30 22:06:26 +0000
committerNadav Rotem <nrotem@apple.com>2012-10-30 22:06:26 +0000
commita368b89f2842530d07c0ac8e3b533882e165f197 (patch)
treed80b722a9c09938c818de95a8b24342700b646d9 /lib/Transforms/Vectorize
parent203e6f60a84096d7fbc0ded932a6636177580198 (diff)
downloadllvm-a368b89f2842530d07c0ac8e3b533882e165f197.tar.gz
llvm-a368b89f2842530d07c0ac8e3b533882e165f197.tar.bz2
llvm-a368b89f2842530d07c0ac8e3b533882e165f197.tar.xz
Add documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167055 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9e05cacbbe..431a8478a0 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -749,16 +749,21 @@ SingleBlockLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) {
}
+/// This function returns the identity element (or neutral element) for
+/// the operation K.
static unsigned
getReductionIdentity(LoopVectorizationLegality::ReductionKind K) {
switch (K) {
case LoopVectorizationLegality::IntegerXor:
case LoopVectorizationLegality::IntegerAdd:
case LoopVectorizationLegality::IntegerOr:
+ // Adding, Xoring, Oring zero to a number does not change it.
return 0;
case LoopVectorizationLegality::IntegerMult:
+ // Multiplying a number by 1 does not change it.
return 1;
case LoopVectorizationLegality::IntegerAnd:
+ // AND-ing a number with an all-1 value does not change it.
return -1;
default:
llvm_unreachable("Unknown reduction kind");