diff options
author | 2017-10-03 11:37:37 -0700 | |
---|---|---|
committer | 2017-10-05 10:42:13 -0700 | |
commit | 46b6dbcd18df0cb5915ca906fefd9f0b0a1af6a2 (patch) | |
tree | 723856081b9d0abcc017b323672e4b1cc99cad16 /compiler/optimizing | |
parent | 844a4edc7f72e33a3b328c3d53ef710909d2273d (diff) |
Try to preserve dex pc better in vector code.
Also improves a few comment and uses new data
type method to test type consistency.
Test: test-art-host
Change-Id: I4a17f9d5bc458a091a259dd45ebcdc6531abbf84
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/data_type.h | 12 | ||||
-rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 3 | ||||
-rw-r--r-- | compiler/optimizing/loop_optimization.cc | 91 | ||||
-rw-r--r-- | compiler/optimizing/nodes_vector.h | 116 | ||||
-rw-r--r-- | compiler/optimizing/nodes_vector_test.cc | 200 |
5 files changed, 248 insertions, 174 deletions
diff --git a/compiler/optimizing/data_type.h b/compiler/optimizing/data_type.h index 5a023ad69b..3b67efe100 100644 --- a/compiler/optimizing/data_type.h +++ b/compiler/optimizing/data_type.h @@ -126,18 +126,6 @@ class DataType { return type == Type::kUint8 || type == Type::kUint16; } - static Type ToSignedType(Type type) { - switch (type) { - case Type::kUint8: - return Type::kInt8; - case Type::kUint16: - return Type::kInt16; - default: - DCHECK(type != Type::kVoid && type != Type::kReference); - return type; - } - } - // Return the general kind of `type`, fusing integer-like types as Type::kInt. static Type Kind(Type type) { switch (type) { diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 36ff2a9ac3..6610bcc713 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -313,7 +313,8 @@ bool InstructionSimplifierVisitor::TryCombineVecMultiplyAccumulate(HVecMul* mul) mul->GetLeft(), mul->GetRight(), binop->GetPackedType(), - binop->GetVectorLength()); + binop->GetVectorLength(), + binop->GetDexPc()); binop->GetBlock()->ReplaceAndRemoveInstructionWith(binop, mulacc); DCHECK(!mul->HasUses()); diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index 2090a12929..c51fafa695 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -1123,7 +1123,7 @@ bool HLoopOptimization::VectorizeUse(LoopNode* node, HInstruction* base = instruction->InputAt(0); HInstruction* index = instruction->InputAt(1); HInstruction* offset = nullptr; - if (DataType::ToSignedType(type) == DataType::ToSignedType(instruction->GetType()) && + if (HVecOperation::ToSignedType(type) == HVecOperation::ToSignedType(instruction->GetType()) && node->loop_info->IsDefinedOutOfTheLoop(base) && induction_range_.IsUnitStride(instruction, index, graph_, &offset)) { if (generate_code) { @@ -1520,7 +1520,7 @@ void HLoopOptimization::GenerateVecInv(HInstruction* org, DataType::Type type) { new (global_allocator_) HTypeConversion(type, input, kNoDexPc)); } vector = new (global_allocator_) - HVecReplicateScalar(global_allocator_, input, type, vector_length_); + HVecReplicateScalar(global_allocator_, input, type, vector_length_, kNoDexPc); vector_permanent_map_->Put(org, Insert(vector_preheader_, vector)); } vector_map_->Put(org, vector); @@ -1546,13 +1546,14 @@ void HLoopOptimization::GenerateVecMem(HInstruction* org, HInstruction* opb, HInstruction* offset, DataType::Type type) { + uint32_t dex_pc = org->GetDexPc(); HInstruction* vector = nullptr; if (vector_mode_ == kVector) { // Vector store or load. HInstruction* base = org->InputAt(0); if (opb != nullptr) { vector = new (global_allocator_) HVecStore( - global_allocator_, base, opa, opb, type, org->GetSideEffects(), vector_length_); + global_allocator_, base, opa, opb, type, org->GetSideEffects(), vector_length_, dex_pc); } else { bool is_string_char_at = org->AsArrayGet()->IsStringCharAt(); vector = new (global_allocator_) HVecLoad(global_allocator_, @@ -1561,7 +1562,8 @@ void HLoopOptimization::GenerateVecMem(HInstruction* org, type, org->GetSideEffects(), vector_length_, - is_string_char_at); + is_string_char_at, + dex_pc); } // Known dynamically enforced alignment? if (vector_peeling_candidate_ != nullptr && @@ -1574,11 +1576,11 @@ void HLoopOptimization::GenerateVecMem(HInstruction* org, DCHECK(vector_mode_ == kSequential); if (opb != nullptr) { vector = new (global_allocator_) HArraySet( - org->InputAt(0), opa, opb, type, org->GetSideEffects(), kNoDexPc); + org->InputAt(0), opa, opb, type, org->GetSideEffects(), dex_pc); } else { bool is_string_char_at = org->AsArrayGet()->IsStringCharAt(); vector = new (global_allocator_) HArrayGet( - org->InputAt(0), opa, type, org->GetSideEffects(), kNoDexPc, is_string_char_at); + org->InputAt(0), opa, type, org->GetSideEffects(), dex_pc, is_string_char_at); } } vector_map_->Put(org, vector); @@ -1627,7 +1629,8 @@ void HLoopOptimization::GenerateVecReductionPhiInputs(HPhi* phi, HInstruction* r &new_init, type, vector_length, - 1)); + 1, + kNoDexPc)); } else { new_init = ReduceAndExtractIfNeeded(new_init); } @@ -1653,10 +1656,10 @@ HInstruction* HLoopOptimization::ReduceAndExtractIfNeeded(HInstruction* instruct // y = x_1 // along the exit of the defining loop. HInstruction* reduce = new (global_allocator_) HVecReduce( - global_allocator_, instruction, type, vector_length, kind); + global_allocator_, instruction, type, vector_length, kind, kNoDexPc); exit->InsertInstructionBefore(reduce, exit->GetFirstInstruction()); instruction = new (global_allocator_) HVecExtractScalar( - global_allocator_, reduce, type, vector_length, 0); + global_allocator_, reduce, type, vector_length, 0, kNoDexPc); exit->InsertInstructionAfter(instruction, reduce); } } @@ -1677,69 +1680,70 @@ void HLoopOptimization::GenerateVecOp(HInstruction* org, HInstruction* opb, DataType::Type type, bool is_unsigned) { + uint32_t dex_pc = org->GetDexPc(); HInstruction* vector = nullptr; DataType::Type org_type = org->GetType(); switch (org->GetKind()) { case HInstruction::kNeg: DCHECK(opb == nullptr); GENERATE_VEC( - new (global_allocator_) HVecNeg(global_allocator_, opa, type, vector_length_), - new (global_allocator_) HNeg(org_type, opa)); + new (global_allocator_) HVecNeg(global_allocator_, opa, type, vector_length_, dex_pc), + new (global_allocator_) HNeg(org_type, opa, dex_pc)); case HInstruction::kNot: DCHECK(opb == nullptr); GENERATE_VEC( - new (global_allocator_) HVecNot(global_allocator_, opa, type, vector_length_), - new (global_allocator_) HNot(org_type, opa)); + new (global_allocator_) HVecNot(global_allocator_, opa, type, vector_length_, dex_pc), + new (global_allocator_) HNot(org_type, opa, dex_pc)); case HInstruction::kBooleanNot: DCHECK(opb == nullptr); GENERATE_VEC( - new (global_allocator_) HVecNot(global_allocator_, opa, type, vector_length_), - new (global_allocator_) HBooleanNot(opa)); + new (global_allocator_) HVecNot(global_allocator_, opa, type, vector_length_, dex_pc), + new (global_allocator_) HBooleanNot(opa, dex_pc)); case HInstruction::kTypeConversion: DCHECK(opb == nullptr); GENERATE_VEC( - new (global_allocator_) HVecCnv(global_allocator_, opa, type, vector_length_), - new (global_allocator_) HTypeConversion(org_type, opa, kNoDexPc)); + new (global_allocator_) HVecCnv(global_allocator_, opa, type, vector_length_, dex_pc), + new (global_allocator_) HTypeConversion(org_type, opa, dex_pc)); case HInstruction::kAdd: GENERATE_VEC( - new (global_allocator_) HVecAdd(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HAdd(org_type, opa, opb)); + new (global_allocator_) HVecAdd(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HAdd(org_type, opa, opb, dex_pc)); case HInstruction::kSub: GENERATE_VEC( - new (global_allocator_) HVecSub(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HSub(org_type, opa, opb)); + new (global_allocator_) HVecSub(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HSub(org_type, opa, opb, dex_pc)); case HInstruction::kMul: GENERATE_VEC( - new (global_allocator_) HVecMul(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HMul(org_type, opa, opb)); + new (global_allocator_) HVecMul(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HMul(org_type, opa, opb, dex_pc)); case HInstruction::kDiv: GENERATE_VEC( - new (global_allocator_) HVecDiv(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HDiv(org_type, opa, opb, kNoDexPc)); + new (global_allocator_) HVecDiv(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HDiv(org_type, opa, opb, dex_pc)); case HInstruction::kAnd: GENERATE_VEC( - new (global_allocator_) HVecAnd(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HAnd(org_type, opa, opb)); + new (global_allocator_) HVecAnd(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HAnd(org_type, opa, opb, dex_pc)); case HInstruction::kOr: GENERATE_VEC( - new (global_allocator_) HVecOr(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HOr(org_type, opa, opb)); + new (global_allocator_) HVecOr(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HOr(org_type, opa, opb, dex_pc)); case HInstruction::kXor: GENERATE_VEC( - new (global_allocator_) HVecXor(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HXor(org_type, opa, opb)); + new (global_allocator_) HVecXor(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HXor(org_type, opa, opb, dex_pc)); case HInstruction::kShl: GENERATE_VEC( - new (global_allocator_) HVecShl(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HShl(org_type, opa, opb)); + new (global_allocator_) HVecShl(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HShl(org_type, opa, opb, dex_pc)); case HInstruction::kShr: GENERATE_VEC( - new (global_allocator_) HVecShr(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HShr(org_type, opa, opb)); + new (global_allocator_) HVecShr(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HShr(org_type, opa, opb, dex_pc)); case HInstruction::kUShr: GENERATE_VEC( - new (global_allocator_) HVecUShr(global_allocator_, opa, opb, type, vector_length_), - new (global_allocator_) HUShr(org_type, opa, opb)); + new (global_allocator_) HVecUShr(global_allocator_, opa, opb, type, vector_length_, dex_pc), + new (global_allocator_) HUShr(org_type, opa, opb, dex_pc)); case HInstruction::kInvokeStaticOrDirect: { HInvokeStaticOrDirect* invoke = org->AsInvokeStaticOrDirect(); if (vector_mode_ == kVector) { @@ -1749,7 +1753,8 @@ void HLoopOptimization::GenerateVecOp(HInstruction* org, case Intrinsics::kMathAbsFloat: case Intrinsics::kMathAbsDouble: DCHECK(opb == nullptr); - vector = new (global_allocator_) HVecAbs(global_allocator_, opa, type, vector_length_); + vector = new (global_allocator_) + HVecAbs(global_allocator_, opa, type, vector_length_, dex_pc); break; case Intrinsics::kMathMinIntInt: case Intrinsics::kMathMinLongLong: @@ -1757,7 +1762,7 @@ void HLoopOptimization::GenerateVecOp(HInstruction* org, case Intrinsics::kMathMinDoubleDouble: { NormalizePackedType(&type, &is_unsigned); vector = new (global_allocator_) - HVecMin(global_allocator_, opa, opb, type, vector_length_, is_unsigned); + HVecMin(global_allocator_, opa, opb, type, vector_length_, is_unsigned, dex_pc); break; } case Intrinsics::kMathMaxIntInt: @@ -1766,7 +1771,7 @@ void HLoopOptimization::GenerateVecOp(HInstruction* org, case Intrinsics::kMathMaxDoubleDouble: { NormalizePackedType(&type, &is_unsigned); vector = new (global_allocator_) - HVecMax(global_allocator_, opa, opb, type, vector_length_, is_unsigned); + HVecMax(global_allocator_, opa, opb, type, vector_length_, is_unsigned, dex_pc); break; } default: @@ -1885,7 +1890,8 @@ bool HLoopOptimization::VectorizeHalvingAddIdiom(LoopNode* node, type, vector_length_, is_rounded, - is_unsigned)); + is_unsigned, + kNoDexPc)); MaybeRecordStat(stats_, MethodCompilationStat::kLoopVectorizedIdiom); } else { GenerateVecOp(instruction, vector_map_->Get(r), vector_map_->Get(s), type); @@ -1981,7 +1987,8 @@ bool HLoopOptimization::VectorizeSADIdiom(LoopNode* node, vector_map_->Get(r), vector_map_->Get(s), reduction_type, - GetOtherVL(reduction_type, sub_type, vector_length_))); + GetOtherVL(reduction_type, sub_type, vector_length_), + kNoDexPc)); MaybeRecordStat(stats_, MethodCompilationStat::kLoopVectorizedIdiom); } else { GenerateVecOp(v, vector_map_->Get(r), nullptr, reduction_type); diff --git a/compiler/optimizing/nodes_vector.h b/compiler/optimizing/nodes_vector.h index d01f8c0289..8f3ab11d00 100644 --- a/compiler/optimizing/nodes_vector.h +++ b/compiler/optimizing/nodes_vector.h @@ -34,7 +34,7 @@ class Alignment { DCHECK(IsPowerOfTwo(base)); } - // Returns true if memory is "at least" aligned at the given boundary. + // Returns true if memory is at least aligned at the given boundary. // Assumes requested base is power of two. bool IsAlignedAt(size_t base) const { DCHECK_NE(0u, base); @@ -42,6 +42,10 @@ class Alignment { return ((offset_ | base_) & (base - 1u)) == 0; } + size_t Base() const { return base_; } + + size_t Offset() const { return offset_; } + std::string ToString() const { return "ALIGN(" + std::to_string(base_) + "," + std::to_string(offset_) + ")"; } @@ -116,6 +120,22 @@ class HVecOperation : public HVariableInputSizeInstruction { return GetVectorLength() == o->GetVectorLength() && GetPackedType() == o->GetPackedType(); } + // Maps an integral type to the same-size signed type and leaves other types alone. + // Can be used to test relaxed type consistency in which packed same-size integral + // types can co-exist, but other type mixes are an error. + static DataType::Type ToSignedType(DataType::Type type) { + switch (type) { + case DataType::Type::kBool: // 1-byte storage unit + case DataType::Type::kUint8: + return DataType::Type::kInt8; + case DataType::Type::kUint16: + return DataType::Type::kInt16; + default: + DCHECK(type != DataType::Type::kVoid && type != DataType::Type::kReference) << type; + return type; + } + } + DECLARE_ABSTRACT_INSTRUCTION(VecOperation); protected: @@ -187,8 +207,7 @@ class HVecBinaryOperation : public HVecOperation { }; // Abstraction of a vector operation that references memory, with an alignment. -// The Android runtime guarantees at least "component size" alignment for array -// elements and, thus, vectors. +// The Android runtime guarantees elements have at least natural alignment. class HVecMemoryOperation : public HVecOperation { public: HVecMemoryOperation(ArenaAllocator* arena, @@ -230,20 +249,7 @@ inline static bool HasConsistentPackedTypes(HInstruction* input, DataType::Type } DCHECK(input->IsVecOperation()); DataType::Type input_type = input->AsVecOperation()->GetPackedType(); - switch (input_type) { - case DataType::Type::kBool: - case DataType::Type::kUint8: - case DataType::Type::kInt8: - return type == DataType::Type::kBool || - type == DataType::Type::kUint8 || - type == DataType::Type::kInt8; - case DataType::Type::kUint16: - case DataType::Type::kInt16: - return type == DataType::Type::kUint16 || - type == DataType::Type::kInt16; - default: - return type == input_type; - } + return HVecOperation::ToSignedType(input_type) == HVecOperation::ToSignedType(type); } // @@ -258,7 +264,7 @@ class HVecReplicateScalar FINAL : public HVecUnaryOperation { HInstruction* scalar, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, scalar, packed_type, vector_length, dex_pc) { DCHECK(!scalar->IsVecOperation()); } @@ -284,7 +290,7 @@ class HVecExtractScalar FINAL : public HVecUnaryOperation { DataType::Type packed_type, size_t vector_length, size_t index, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(input, packed_type)); DCHECK_LT(index, vector_length); @@ -322,7 +328,7 @@ class HVecReduce FINAL : public HVecUnaryOperation { DataType::Type packed_type, size_t vector_length, ReductionKind kind, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc), kind_(kind) { DCHECK(HasConsistentPackedTypes(input, packed_type)); @@ -354,7 +360,7 @@ class HVecCnv FINAL : public HVecUnaryOperation { HInstruction* input, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc) { DCHECK(input->IsVecOperation()); DCHECK_NE(GetInputType(), GetResultType()); // actual convert @@ -379,7 +385,7 @@ class HVecNeg FINAL : public HVecUnaryOperation { HInstruction* input, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(input, packed_type)); } @@ -393,14 +399,15 @@ class HVecNeg FINAL : public HVecUnaryOperation { }; // Takes absolute value of every component in the vector, -// viz. abs[ x1, .. , xn ] = [ |x1|, .. , |xn| ]. +// viz. abs[ x1, .. , xn ] = [ |x1|, .. , |xn| ] +// for signed operand x. class HVecAbs FINAL : public HVecUnaryOperation { public: HVecAbs(ArenaAllocator* arena, HInstruction* input, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(input, packed_type)); } @@ -422,7 +429,7 @@ class HVecNot FINAL : public HVecUnaryOperation { HInstruction* input, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecUnaryOperation(arena, input, packed_type, vector_length, dex_pc) { DCHECK(input->IsVecOperation()); } @@ -448,7 +455,7 @@ class HVecAdd FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); DCHECK(HasConsistentPackedTypes(right, packed_type)); @@ -465,7 +472,7 @@ class HVecAdd FINAL : public HVecBinaryOperation { // Performs halving add on every component in the two vectors, viz. // rounded [ x1, .. , xn ] hradd [ y1, .. , yn ] = [ (x1 + y1 + 1) >> 1, .. , (xn + yn + 1) >> 1 ] // truncated [ x1, .. , xn ] hadd [ y1, .. , yn ] = [ (x1 + y1) >> 1, .. , (xn + yn ) >> 1 ] -// for signed operands x, y (sign extension) or unsigned operands x, y (zero extension). +// for either both signed or both unsigned operands x, y. class HVecHalvingAdd FINAL : public HVecBinaryOperation { public: HVecHalvingAdd(ArenaAllocator* arena, @@ -474,8 +481,9 @@ class HVecHalvingAdd FINAL : public HVecBinaryOperation { DataType::Type packed_type, size_t vector_length, bool is_rounded, - bool is_unsigned = false) - : HVecBinaryOperation(arena, left, right, packed_type, vector_length, kNoDexPc) { + bool is_unsigned, + uint32_t dex_pc) + : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { // The `is_unsigned` flag should be used exclusively with the Int32 or Int64. // This flag is a temporary measure while we do not have the Uint32 and Uint64 data types. DCHECK(!is_unsigned || @@ -521,7 +529,7 @@ class HVecSub FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); DCHECK(HasConsistentPackedTypes(right, packed_type)); @@ -544,7 +552,7 @@ class HVecMul FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); DCHECK(HasConsistentPackedTypes(right, packed_type)); @@ -567,7 +575,7 @@ class HVecDiv FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); DCHECK(HasConsistentPackedTypes(right, packed_type)); @@ -582,7 +590,8 @@ class HVecDiv FINAL : public HVecBinaryOperation { }; // Takes minimum of every component in the two vectors, -// viz. MIN( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ min(x1, y1), .. , min(xn, yn) ]. +// viz. MIN( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ min(x1, y1), .. , min(xn, yn) ] +// for either both signed or both unsigned operands x, y. class HVecMin FINAL : public HVecBinaryOperation { public: HVecMin(ArenaAllocator* arena, @@ -590,8 +599,9 @@ class HVecMin FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - bool is_unsigned = false) - : HVecBinaryOperation(arena, left, right, packed_type, vector_length, kNoDexPc) { + bool is_unsigned, + uint32_t dex_pc) + : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { // The `is_unsigned` flag should be used exclusively with the Int32 or Int64. // This flag is a temporary measure while we do not have the Uint32 and Uint64 data types. DCHECK(!is_unsigned || @@ -624,7 +634,8 @@ class HVecMin FINAL : public HVecBinaryOperation { }; // Takes maximum of every component in the two vectors, -// viz. MAX( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ max(x1, y1), .. , max(xn, yn) ]. +// viz. MAX( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ max(x1, y1), .. , max(xn, yn) ] +// for either both signed or both unsigned operands x, y. class HVecMax FINAL : public HVecBinaryOperation { public: HVecMax(ArenaAllocator* arena, @@ -632,8 +643,9 @@ class HVecMax FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - bool is_unsigned = false) - : HVecBinaryOperation(arena, left, right, packed_type, vector_length, kNoDexPc) { + bool is_unsigned, + uint32_t dex_pc) + : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { // The `is_unsigned` flag should be used exclusively with the Int32 or Int64. // This flag is a temporary measure while we do not have the Uint32 and Uint64 data types. DCHECK(!is_unsigned || @@ -674,7 +686,7 @@ class HVecAnd FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(left->IsVecOperation() && right->IsVecOperation()); } @@ -696,7 +708,7 @@ class HVecAndNot FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(left->IsVecOperation() && right->IsVecOperation()); } @@ -718,7 +730,7 @@ class HVecOr FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(left->IsVecOperation() && right->IsVecOperation()); } @@ -740,7 +752,7 @@ class HVecXor FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(left->IsVecOperation() && right->IsVecOperation()); } @@ -762,7 +774,7 @@ class HVecShl FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); } @@ -784,7 +796,7 @@ class HVecShr FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); } @@ -806,7 +818,7 @@ class HVecUShr FINAL : public HVecBinaryOperation { HInstruction* right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecBinaryOperation(arena, left, right, packed_type, vector_length, dex_pc) { DCHECK(HasConsistentPackedTypes(left, packed_type)); } @@ -833,7 +845,7 @@ class HVecSetScalars FINAL : public HVecOperation { DataType::Type packed_type, size_t vector_length, size_t number_of_scalars, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecOperation(arena, packed_type, SideEffects::None(), @@ -867,7 +879,7 @@ class HVecMultiplyAccumulate FINAL : public HVecOperation { HInstruction* mul_right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecOperation(arena, packed_type, SideEffects::None(), @@ -905,9 +917,9 @@ class HVecMultiplyAccumulate FINAL : public HVecOperation { // Takes the absolute difference of two vectors, and adds the results to // same-precision or wider-precision components in the accumulator, -// viz. SAD([ a1, .. , am ], [ x1, .. , xn ], [ y1, .. , yn ] = +// viz. SAD([ a1, .. , am ], [ x1, .. , xn ], [ y1, .. , yn ]) = // [ a1 + sum abs(xi-yi), .. , am + sum abs(xj-yj) ], -// for m <= n and non-overlapping sums. +// for m <= n, non-overlapping sums, and signed operands x, y. class HVecSADAccumulate FINAL : public HVecOperation { public: HVecSADAccumulate(ArenaAllocator* arena, @@ -916,7 +928,7 @@ class HVecSADAccumulate FINAL : public HVecOperation { HInstruction* sad_right, DataType::Type packed_type, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecOperation(arena, packed_type, SideEffects::None(), @@ -950,7 +962,7 @@ class HVecLoad FINAL : public HVecMemoryOperation { SideEffects side_effects, size_t vector_length, bool is_string_char_at, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecMemoryOperation(arena, packed_type, side_effects, @@ -994,7 +1006,7 @@ class HVecStore FINAL : public HVecMemoryOperation { DataType::Type packed_type, SideEffects side_effects, size_t vector_length, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HVecMemoryOperation(arena, packed_type, side_effects, diff --git a/compiler/optimizing/nodes_vector_test.cc b/compiler/optimizing/nodes_vector_test.cc index 7dbfcda736..d3a499cb31 100644 --- a/compiler/optimizing/nodes_vector_test.cc +++ b/compiler/optimizing/nodes_vector_test.cc @@ -42,11 +42,6 @@ class NodesVectorTest : public CommonCompilerTest { graph_->AddBlock(exit_block_); graph_->SetEntryBlock(entry_block_); graph_->SetExitBlock(exit_block_); - parameter_ = new (&allocator_) HParameterValue(graph_->GetDexFile(), - dex::TypeIndex(0), - 0, - DataType::Type::kInt32); - entry_block_->AddInstruction(parameter_); int8_parameter_ = new (&allocator_) HParameterValue(graph_->GetDexFile(), dex::TypeIndex(1), 0, @@ -57,6 +52,11 @@ class NodesVectorTest : public CommonCompilerTest { 0, DataType::Type::kInt16); entry_block_->AddInstruction(int16_parameter_); + int32_parameter_ = new (&allocator_) HParameterValue(graph_->GetDexFile(), + dex::TypeIndex(0), + 0, + DataType::Type::kInt32); + entry_block_->AddInstruction(int32_parameter_); } // General building fields. @@ -67,9 +67,9 @@ class NodesVectorTest : public CommonCompilerTest { HBasicBlock* entry_block_; HBasicBlock* exit_block_; - HInstruction* parameter_; HInstruction* int8_parameter_; HInstruction* int16_parameter_; + HInstruction* int32_parameter_; }; // @@ -104,6 +104,10 @@ TEST(NodesVector, Alignment) { EXPECT_FALSE(Alignment(16, 1).IsAlignedAt(16)); EXPECT_FALSE(Alignment(16, 7).IsAlignedAt(16)); EXPECT_FALSE(Alignment(16, 0).IsAlignedAt(32)); + + EXPECT_EQ(16u, Alignment(16, 0).Base()); + EXPECT_EQ(0u, Alignment(16, 0).Offset()); + EXPECT_EQ(4u, Alignment(16, 4).Offset()); } TEST(NodesVector, AlignmentEQ) { @@ -131,21 +135,22 @@ TEST(NodesVector, AlignmentString) { TEST_F(NodesVectorTest, VectorOperationProperties) { HVecOperation* v0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecOperation* v1 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecOperation* v2 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 2); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 2, kNoDexPc); HVecOperation* v3 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt16, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt16, 4, kNoDexPc); HVecOperation* v4 = new (&allocator_) HVecStore( &allocator_, - parameter_, - parameter_, + int32_parameter_, + int32_parameter_, v0, DataType::Type::kInt32, SideEffects::ArrayWriteOfType(DataType::Type::kInt32), - 4); + 4, + kNoDexPc); EXPECT_TRUE(v0->Equals(v0)); EXPECT_TRUE(v1->Equals(v1)); @@ -194,26 +199,29 @@ TEST_F(NodesVectorTest, VectorOperationProperties) { TEST_F(NodesVectorTest, VectorAlignmentAndStringCharAtMatterOnLoad) { HVecLoad* v0 = new (&allocator_) HVecLoad(&allocator_, - parameter_, - parameter_, + int32_parameter_, + int32_parameter_, DataType::Type::kInt32, SideEffects::ArrayReadOfType(DataType::Type::kInt32), 4, - /*is_string_char_at*/ false); + /*is_string_char_at*/ false, + kNoDexPc); HVecLoad* v1 = new (&allocator_) HVecLoad(&allocator_, - parameter_, - parameter_, + int32_parameter_, + int32_parameter_, DataType::Type::kInt32, SideEffects::ArrayReadOfType(DataType::Type::kInt32), 4, - /*is_string_char_at*/ false); + /*is_string_char_at*/ false, + kNoDexPc); HVecLoad* v2 = new (&allocator_) HVecLoad(&allocator_, - parameter_, - parameter_, + int32_parameter_, + int32_parameter_, DataType::Type::kInt32, SideEffects::ArrayReadOfType(DataType::Type::kInt32), 4, - /*is_string_char_at*/ true); + /*is_string_char_at*/ true, + kNoDexPc); EXPECT_TRUE(v0->CanBeMoved()); EXPECT_TRUE(v1->CanBeMoved()); @@ -228,7 +236,7 @@ TEST_F(NodesVectorTest, VectorAlignmentAndStringCharAtMatterOnLoad) { EXPECT_TRUE(v2->Equals(v2)); EXPECT_TRUE(v0->Equals(v1)); - EXPECT_FALSE(v0->Equals(v2)); + EXPECT_FALSE(v0->Equals(v2)); // different is_string_char_at EXPECT_TRUE(v0->GetAlignment() == Alignment(4, 0)); EXPECT_TRUE(v1->GetAlignment() == Alignment(4, 0)); @@ -241,24 +249,65 @@ TEST_F(NodesVectorTest, VectorAlignmentAndStringCharAtMatterOnLoad) { EXPECT_FALSE(v0->Equals(v1)); // no longer equal } +TEST_F(NodesVectorTest, VectorAlignmentMattersOnStore) { + HVecOperation* p0 = new (&allocator_) + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); + HVecStore* v0 = new (&allocator_) HVecStore( + &allocator_, + int32_parameter_, + int32_parameter_, + p0, + DataType::Type::kInt32, + SideEffects::ArrayWriteOfType(DataType::Type::kInt32), + 4, + kNoDexPc); + HVecStore* v1 = new (&allocator_) HVecStore( + &allocator_, + int32_parameter_, + int32_parameter_, + p0, + DataType::Type::kInt32, + SideEffects::ArrayWriteOfType(DataType::Type::kInt32), + 4, + kNoDexPc); + + EXPECT_FALSE(v0->CanBeMoved()); + EXPECT_FALSE(v1->CanBeMoved()); + + EXPECT_TRUE(v0->Equals(v1)); + + EXPECT_TRUE(v0->GetAlignment() == Alignment(4, 0)); + EXPECT_TRUE(v1->GetAlignment() == Alignment(4, 0)); + + v1->SetAlignment(Alignment(8, 0)); + + EXPECT_TRUE(v1->GetAlignment() == Alignment(8, 0)); + + EXPECT_FALSE(v0->Equals(v1)); // no longer equal +} + TEST_F(NodesVectorTest, VectorSignMattersOnMin) { HVecOperation* p0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecOperation* p1 = new (&allocator_) - HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4); + HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4, kNoDexPc); HVecOperation* p2 = new (&allocator_) - HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4); + HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4, kNoDexPc); HVecMin* v0 = new (&allocator_) HVecMin( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ true); + &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ true, kNoDexPc); HVecMin* v1 = new (&allocator_) HVecMin( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ false); + &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ false, kNoDexPc); HVecMin* v2 = new (&allocator_) HVecMin( - &allocator_, p0, p0, DataType::Type::kInt32, 2, /*is_unsigned*/ true); - HVecMin* v3 = new (&allocator_) HVecMin(&allocator_, p1, p1, DataType::Type::kUint8, 16); - HVecMin* v4 = new (&allocator_) HVecMin(&allocator_, p1, p1, DataType::Type::kInt8, 16); - HVecMin* v5 = new (&allocator_) HVecMin(&allocator_, p2, p2, DataType::Type::kUint16, 8); - HVecMin* v6 = new (&allocator_) HVecMin(&allocator_, p2, p2, DataType::Type::kInt16, 8); + &allocator_, p0, p0, DataType::Type::kInt32, 2, /*is_unsigned*/ true, kNoDexPc); + HVecMin* v3 = new (&allocator_) HVecMin( + &allocator_, p1, p1, DataType::Type::kUint8, 16, /*is_unsigned*/ false, kNoDexPc); + HVecMin* v4 = new (&allocator_) HVecMin( + &allocator_, p1, p1, DataType::Type::kInt8, 16, /*is_unsigned*/ false, kNoDexPc); + HVecMin* v5 = new (&allocator_) HVecMin( + &allocator_, p2, p2, DataType::Type::kUint16, 8, /*is_unsigned*/ false, kNoDexPc); + HVecMin* v6 = new (&allocator_) HVecMin( + &allocator_, p2, p2, DataType::Type::kInt16, 8, /*is_unsigned*/ false, kNoDexPc); HVecMin* min_insns[] = { v0, v1, v2, v3, v4, v5, v6 }; EXPECT_FALSE(p0->CanBeMoved()); @@ -283,22 +332,26 @@ TEST_F(NodesVectorTest, VectorSignMattersOnMin) { TEST_F(NodesVectorTest, VectorSignMattersOnMax) { HVecOperation* p0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecOperation* p1 = new (&allocator_) - HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4); + HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4, kNoDexPc); HVecOperation* p2 = new (&allocator_) - HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4); + HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4, kNoDexPc); HVecMax* v0 = new (&allocator_) HVecMax( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ true); + &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ true, kNoDexPc); HVecMax* v1 = new (&allocator_) HVecMax( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ false); + &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_unsigned*/ false, kNoDexPc); HVecMax* v2 = new (&allocator_) HVecMax( - &allocator_, p0, p0, DataType::Type::kInt32, 2, /*is_unsigned*/ true); - HVecMax* v3 = new (&allocator_) HVecMax(&allocator_, p1, p1, DataType::Type::kUint8, 16); - HVecMax* v4 = new (&allocator_) HVecMax(&allocator_, p1, p1, DataType::Type::kInt8, 16); - HVecMax* v5 = new (&allocator_) HVecMax(&allocator_, p2, p2, DataType::Type::kUint16, 8); - HVecMax* v6 = new (&allocator_) HVecMax(&allocator_, p2, p2, DataType::Type::kInt16, 8); + &allocator_, p0, p0, DataType::Type::kInt32, 2, /*is_unsigned*/ true, kNoDexPc); + HVecMax* v3 = new (&allocator_) HVecMax( + &allocator_, p1, p1, DataType::Type::kUint8, 16, /*is_unsigned*/ false, kNoDexPc); + HVecMax* v4 = new (&allocator_) HVecMax( + &allocator_, p1, p1, DataType::Type::kInt8, 16, /*is_unsigned*/ false, kNoDexPc); + HVecMax* v5 = new (&allocator_) HVecMax( + &allocator_, p2, p2, DataType::Type::kUint16, 8, /*is_unsigned*/ false, kNoDexPc); + HVecMax* v6 = new (&allocator_) HVecMax( + &allocator_, p2, p2, DataType::Type::kInt16, 8, /*is_unsigned*/ false, kNoDexPc); HVecMax* max_insns[] = { v0, v1, v2, v3, v4, v5, v6 }; EXPECT_FALSE(p0->CanBeMoved()); @@ -323,38 +376,51 @@ TEST_F(NodesVectorTest, VectorSignMattersOnMax) { TEST_F(NodesVectorTest, VectorAttributesMatterOnHalvingAdd) { HVecOperation* p0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecOperation* p1 = new (&allocator_) - HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4); + HVecReplicateScalar(&allocator_, int8_parameter_, DataType::Type::kInt8, 4, kNoDexPc); HVecOperation* p2 = new (&allocator_) - HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4); + HVecReplicateScalar(&allocator_, int16_parameter_, DataType::Type::kInt16, 4, kNoDexPc); HVecHalvingAdd* v0 = new (&allocator_) HVecHalvingAdd( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_rounded*/ true, /*is_unsigned*/ true); + &allocator_, p0, p0, DataType::Type::kInt32, 4, + /*is_rounded*/ true, /*is_unsigned*/ true, kNoDexPc); HVecHalvingAdd* v1 = new (&allocator_) HVecHalvingAdd( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_rounded*/ false, /*is_unsigned*/ true); + &allocator_, p0, p0, DataType::Type::kInt32, 4, + /*is_rounded*/ false, /*is_unsigned*/ true, kNoDexPc); HVecHalvingAdd* v2 = new (&allocator_) HVecHalvingAdd( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_rounded*/ true, /*is_unsigned*/ false); + &allocator_, p0, p0, DataType::Type::kInt32, 4, + /*is_rounded*/ true, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v3 = new (&allocator_) HVecHalvingAdd( - &allocator_, p0, p0, DataType::Type::kInt32, 4, /*is_rounded*/ false, /*is_unsigned*/ false); + &allocator_, p0, p0, DataType::Type::kInt32, 4, + /*is_rounded*/ false, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v4 = new (&allocator_) HVecHalvingAdd( - &allocator_, p0, p0, DataType::Type::kInt32, 2, /*is_rounded*/ true, /*is_unsigned*/ true); + &allocator_, p0, p0, DataType::Type::kInt32, 2, + /*is_rounded*/ true, /*is_unsigned*/ true, kNoDexPc); HVecHalvingAdd* v5 = new (&allocator_) HVecHalvingAdd( - &allocator_, p1, p1, DataType::Type::kUint8, 16, /*is_rounded*/ true); + &allocator_, p1, p1, DataType::Type::kUint8, 16, + /*is_rounded*/ true, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v6 = new (&allocator_) HVecHalvingAdd( - &allocator_, p1, p1, DataType::Type::kUint8, 16, /*is_rounded*/ false); + &allocator_, p1, p1, DataType::Type::kUint8, 16, + /*is_rounded*/ false, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v7 = new (&allocator_) HVecHalvingAdd( - &allocator_, p1, p1, DataType::Type::kInt8, 16, /*is_rounded*/ true); + &allocator_, p1, p1, DataType::Type::kInt8, 16, + /*is_rounded*/ true, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v8 = new (&allocator_) HVecHalvingAdd( - &allocator_, p1, p1, DataType::Type::kInt8, 16, /*is_rounded*/ false); + &allocator_, p1, p1, DataType::Type::kInt8, 16, + /*is_rounded*/ false, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v9 = new (&allocator_) HVecHalvingAdd( - &allocator_, p2, p2, DataType::Type::kUint16, 8, /*is_rounded*/ true); + &allocator_, p2, p2, DataType::Type::kUint16, 8, + /*is_rounded*/ true, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v10 = new (&allocator_) HVecHalvingAdd( - &allocator_, p2, p2, DataType::Type::kUint16, 8, /*is_rounded*/ false); + &allocator_, p2, p2, DataType::Type::kUint16, 8, + /*is_rounded*/ false, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v11 = new (&allocator_) HVecHalvingAdd( - &allocator_, p2, p2, DataType::Type::kInt16, 2, /*is_rounded*/ true); + &allocator_, p2, p2, DataType::Type::kInt16, 2, + /*is_rounded*/ true, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* v12 = new (&allocator_) HVecHalvingAdd( - &allocator_, p2, p2, DataType::Type::kInt16, 2, /*is_rounded*/ false); + &allocator_, p2, p2, DataType::Type::kInt16, 2, + /*is_rounded*/ false, /*is_unsigned*/ false, kNoDexPc); HVecHalvingAdd* hadd_insns[] = { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 }; EXPECT_FALSE(p0->CanBeMoved()); @@ -395,14 +461,14 @@ TEST_F(NodesVectorTest, VectorAttributesMatterOnHalvingAdd) { TEST_F(NodesVectorTest, VectorOperationMattersOnMultiplyAccumulate) { HVecOperation* v0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecMultiplyAccumulate* v1 = new (&allocator_) HVecMultiplyAccumulate( - &allocator_, HInstruction::kAdd, v0, v0, v0, DataType::Type::kInt32, 4); + &allocator_, HInstruction::kAdd, v0, v0, v0, DataType::Type::kInt32, 4, kNoDexPc); HVecMultiplyAccumulate* v2 = new (&allocator_) HVecMultiplyAccumulate( - &allocator_, HInstruction::kSub, v0, v0, v0, DataType::Type::kInt32, 4); + &allocator_, HInstruction::kSub, v0, v0, v0, DataType::Type::kInt32, 4, kNoDexPc); HVecMultiplyAccumulate* v3 = new (&allocator_) HVecMultiplyAccumulate( - &allocator_, HInstruction::kAdd, v0, v0, v0, DataType::Type::kInt32, 2); + &allocator_, HInstruction::kAdd, v0, v0, v0, DataType::Type::kInt32, 2, kNoDexPc); EXPECT_FALSE(v0->CanBeMoved()); EXPECT_TRUE(v1->CanBeMoved()); @@ -423,14 +489,14 @@ TEST_F(NodesVectorTest, VectorOperationMattersOnMultiplyAccumulate) { TEST_F(NodesVectorTest, VectorKindMattersOnReduce) { HVecOperation* v0 = new (&allocator_) - HVecReplicateScalar(&allocator_, parameter_, DataType::Type::kInt32, 4); + HVecReplicateScalar(&allocator_, int32_parameter_, DataType::Type::kInt32, 4, kNoDexPc); HVecReduce* v1 = new (&allocator_) HVecReduce( - &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kSum); + &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kSum, kNoDexPc); HVecReduce* v2 = new (&allocator_) HVecReduce( - &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kMin); + &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kMin, kNoDexPc); HVecReduce* v3 = new (&allocator_) HVecReduce( - &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kMax); + &allocator_, v0, DataType::Type::kInt32, 4, HVecReduce::kMax, kNoDexPc); EXPECT_FALSE(v0->CanBeMoved()); EXPECT_TRUE(v1->CanBeMoved()); |