diff options
author | 2024-09-14 01:26:02 +0100 | |
---|---|---|
committer | 2024-10-15 16:29:45 +0000 | |
commit | 6127341b747ac26b361fd1779e155d940d49e39f (patch) | |
tree | e1c40de3dda7f6bc5048fff6ea5fb4deaffe6bbc /compiler/optimizing/optimizing_unit_test.h | |
parent | b50d59f4ca5557a7719dc26157f8f2fd9006913a (diff) |
Arm64: fix VecPredToBoolean code generation for SVE
This patch fixes code generation for VecPredToBoolean so it updates
conditional flags itself based on its predicate input. Prior to this
patch, code generation for VecPredToBoolean (incorrectly) implicitly
assumed that the conditional flags were always updated by its input
HIR (VecPredWhile) and that it immediately followed that HIR.
Authors: Konstantin Baladurin <konstantin.baladurin@arm.com>
Chris Jones <christopher.jones@arm.com>
Test: env ART_FORCE_TRY_PREDICATED_SIMD=true
art/test.py --target --optimizing
Test: art/tools/run-gtests.sh
Change-Id: Id4c2494cdefd008509f9039e36081151aaf0e4a6
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r-- | compiler/optimizing/optimizing_unit_test.h | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index a7c3558c5f..e2f3e0a510 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -632,15 +632,54 @@ class OptimizingUnitTestHelper { HInstruction* index, HInstruction* value, DataType::Type packed_type, - size_t vector_length = 4, + size_t vector_size_in_bytes = kDefaultTestVectorSize, uint32_t dex_pc = kNoDexPc) { + size_t num_of_elements = GetNumberOfElementsInVector(vector_size_in_bytes, packed_type); SideEffects side_effects = SideEffects::ArrayWriteOfType(packed_type); HVecStore* vec_store = new (GetAllocator()) HVecStore( - GetAllocator(), base, index, value, packed_type, side_effects, vector_length, dex_pc); + GetAllocator(), base, index, value, packed_type, side_effects, num_of_elements, dex_pc); AddOrInsertInstruction(block, vec_store); return vec_store; } + HVecPredToBoolean* MakeVecPredToBoolean(HBasicBlock* block, + HInstruction* input, + HVecPredToBoolean::PCondKind pred_cond, + DataType::Type packed_type, + size_t vector_size_in_bytes = kDefaultTestVectorSize, + uint32_t dex_pc = kNoDexPc) { + size_t num_of_elements = GetNumberOfElementsInVector(vector_size_in_bytes, packed_type); + HVecPredToBoolean* vec_pred_to_boolean = new (GetAllocator()) HVecPredToBoolean( + GetAllocator(), + input, + pred_cond, + packed_type, + num_of_elements, + dex_pc); + AddOrInsertInstruction(block, vec_pred_to_boolean); + return vec_pred_to_boolean; + } + + HVecPredWhile* MakeVecPredWhile(HBasicBlock* block, + HInstruction* left, + HInstruction* right, + HVecPredWhile::CondKind cond, + DataType::Type packed_type, + size_t vector_size_in_bytes = kDefaultTestVectorSize, + uint32_t dex_pc = kNoDexPc) { + size_t num_of_elements = GetNumberOfElementsInVector(vector_size_in_bytes, packed_type); + HVecPredWhile* vec_pred_while = new (GetAllocator()) HVecPredWhile( + GetAllocator(), + left, + right, + cond, + packed_type, + num_of_elements, + dex_pc); + AddOrInsertInstruction(block, vec_pred_while); + return vec_pred_while; + } + HInvokeStaticOrDirect* MakeInvokeStatic(HBasicBlock* block, DataType::Type return_type, const std::vector<HInstruction*>& args, @@ -836,6 +875,10 @@ class OptimizingUnitTestHelper { size_t class_idx_ = 42; uint32_t method_idx_ = 100; + // The default size of vectors to use for tests, in bytes. 16 bytes (128 bits) is used as it is + // commonly the smallest size of vector used in vector extensions. + static constexpr size_t kDefaultTestVectorSize = 16; + ScopedNullHandle<mirror::Class> null_klass_; }; |