RFR: 8333684: C2 SuperWord: multiple smaller refactorings in preparation for JDK-8332163 [v3]
Christian Hagedorn
chagedorn at openjdk.org
Wed Jun 12 13:04:16 UTC 2024
On Wed, 12 Jun 2024 12:46:27 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> In preparation for https://github.com/openjdk/jdk/pull/19261, I made some smaller refactorings / moving code around:
>>
>> - `SuperWord::same_input` -> `PackSet::isa_unique_input_or_null`
>> - Rename print-method tags: `SUPERWORD1_BEFORE_SCHEDULE` -> `AUTO_VECTORIZATION1_BEFORE_APPLY` etc.
>> - Refactored `SuperWord::schedule / output` -> `SuperWord::schedule_and_apply`:
>> - Reorganize so that we can separate out all methods that change the C2 graph into `SuperWord::apply`.
>> - Move all `phase()->C->print_method` to `SuperWord::apply`.
>> - Rename `SuperWord::schedule_reorder_memops` -> `SuperWord::apply_memops_reordering_with_schedule`.
>> - Rename `SuperWord::output` -> `SuperWord::apply_vectorization`.
>> - Move `SuperWord::vectors_should_be_aligned` -> `VLoop::vectors_should_be_aligned`.
>> - Move `SuperWord::requires_long_to_int_conversion` -> `VectorNode::is_scalar_op_that_returns_int_but_vector_op_returns_long`, and move comments.
>> - Move `VectorNode::can_transform_shift_op` -> `VectorNode::can_use_RShiftI_instead_of_URShiftI`, and move comments.
>> - Extract out `PackSet::get_bool_test` from `SuperWord::output / apply_vectorization`.
>> - Extract opcode check to `VectorNode::is_scalar_unary_op_with_equal_input_and_output_types`.
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>
> for Christian
One more minor suggestion, otherwise, looks good! Thanks for the updates.
src/hotspot/share/opto/superword.cpp line 1628:
> 1626: Node* unique = pack->at(0)->in(j);
> 1627: for (uint i = 1; i < pack->size(); i++) {
> 1628: if (pack->at(i)->in(j) != unique) {
Maybe we could directly name it `index` to match the method name and also make it `const` for completeness:
Suggestion:
// If the input 'index' for all nodes in the pack is the same unique input: return it, else nullptr.
Node* PackSet::same_inputs_at_index_or_null(const Node_List* pack, const int index) const {
Node* unique = pack->at(0)->in(index);
for (uint i = 1; i < pack->size(); i++) {
if (pack->at(i)->in(index) != unique) {
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/19573#pullrequestreview-2112950275
PR Review Comment: https://git.openjdk.org/jdk/pull/19573#discussion_r1636422501
More information about the hotspot-compiler-dev
mailing list