diff options
author | Aart Bik <ajcbik@google.com> | 2017-08-31 09:08:13 -0700 |
---|---|---|
committer | Aart Bik <ajcbik@google.com> | 2017-09-01 10:32:50 -0700 |
commit | cfa59b49cde265dc5329a7e6956445f9f7a75f15 (patch) | |
tree | eed953f62e796f7e64252520a40d7e77d1f117af /compiler/optimizing/loop_optimization.h | |
parent | 82a63734d3067ea0c96f8ba15bc40caaf798c625 (diff) |
Basic SIMD reduction support.
Rationale:
Enables vectorization of x += .... for very basic (simple, same-type)
constructs. Paves the way for more complex (narrower and/or mixed-type)
constructs, which will be handled by the next CL.
This is a revert^2 of I7880c135aee3ed0a39da9ae5b468cbf80e613766
and thus a revert of I1c1c87b6323e01442e8fbd94869ddc9e760ea1fc
PS1-2 shows what needed to change, with regression tests
Test: test-art-host test-art-target
Bug: 64091002, 65212948
Change-Id: I2454778dd0ef1da915c178c7274e1cf33e271d0f
Diffstat (limited to 'compiler/optimizing/loop_optimization.h')
-rw-r--r-- | compiler/optimizing/loop_optimization.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/compiler/optimizing/loop_optimization.h b/compiler/optimizing/loop_optimization.h index 49be8a3fb4..ba9126c5f6 100644 --- a/compiler/optimizing/loop_optimization.h +++ b/compiler/optimizing/loop_optimization.h @@ -62,17 +62,18 @@ class HLoopOptimization : public HOptimization { * Vectorization restrictions (bit mask). */ enum VectorRestrictions { - kNone = 0, // no restrictions - kNoMul = 1, // no multiplication - kNoDiv = 2, // no division - kNoShift = 4, // no shift - kNoShr = 8, // no arithmetic shift right - kNoHiBits = 16, // "wider" operations cannot bring in higher order bits - kNoSignedHAdd = 32, // no signed halving add - kNoUnroundedHAdd = 64, // no unrounded halving add - kNoAbs = 128, // no absolute value - kNoMinMax = 256, // no min/max - kNoStringCharAt = 512, // no StringCharAt + kNone = 0, // no restrictions + kNoMul = 1 << 0, // no multiplication + kNoDiv = 1 << 1, // no division + kNoShift = 1 << 2, // no shift + kNoShr = 1 << 3, // no arithmetic shift right + kNoHiBits = 1 << 4, // "wider" operations cannot bring in higher order bits + kNoSignedHAdd = 1 << 5, // no signed halving add + kNoUnroundedHAdd = 1 << 6, // no unrounded halving add + kNoAbs = 1 << 7, // no absolute value + kNoMinMax = 1 << 8, // no min/max + kNoStringCharAt = 1 << 9, // no StringCharAt + kNoReduction = 1 << 10, // no reduction }; /* @@ -155,6 +156,9 @@ class HLoopOptimization : public HOptimization { HInstruction* opb, HInstruction* offset, Primitive::Type type); + void GenerateVecReductionPhi(HPhi* phi); + void GenerateVecReductionPhiInputs(HPhi* phi, HInstruction* reduction); + HInstruction* ReduceAndExtractIfNeeded(HInstruction* instruction); void GenerateVecOp(HInstruction* org, HInstruction* opa, HInstruction* opb, @@ -253,6 +257,10 @@ class HLoopOptimization : public HOptimization { // Contents reside in phase-local heap memory. ArenaSafeMap<HInstruction*, HInstruction*>* vector_map_; + // Permanent mapping used during vectorization synthesis. + // Contents reside in phase-local heap memory. + ArenaSafeMap<HInstruction*, HInstruction*>* vector_permanent_map_; + // Temporary vectorization bookkeeping. VectorMode vector_mode_; // synthesis mode HBasicBlock* vector_preheader_; // preheader of the new loop |