Skip to content

Commit

Permalink
8324750: C2: rename Matcher methods using "superword" -> "autovectori…
Browse files Browse the repository at this point in the history
…zation"

Reviewed-by: kvn, chagedorn
  • Loading branch information
eme64 committed Jan 29, 2024
1 parent 6ad78ca commit f0bae79
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return MIN2(size, max_size);
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
return Matcher::max_vector_size(bt);
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/aarch64_vector.ad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
Expand Down Expand Up @@ -126,7 +126,7 @@ source %{
}
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
if (UseSVE == 0) {
// These operations are not profitable to be vectorized on NEON, because no direct
// NEON instructions support them. But the match rule support for them is profitable for
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/aarch64_vector_ad.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
Expand Down Expand Up @@ -116,7 +116,7 @@ source %{
}
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
if (UseSVE == 0) {
// These operations are not profitable to be vectorized on NEON, because no direct
// NEON instructions support them. But the match rule support for them is profitable for
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/arm/arm.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ bool Matcher::match_rule_supported(int opcode) {
return true; // Per default match rules are supported.
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
return match_rule_supported_vector(opcode, vlen, bt);
}

Expand Down Expand Up @@ -1074,7 +1074,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return 8/type2aelembytes(bt);
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
return Matcher::max_vector_size(bt);
}

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/ppc/ppc.ad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2012, 2023 SAP SE. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
Expand Down Expand Up @@ -2173,7 +2173,7 @@ bool Matcher::match_rule_supported(int opcode) {
return true; // Per default match rules are supported.
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
return match_rule_supported_vector(opcode, vlen, bt);
}

Expand Down Expand Up @@ -2242,7 +2242,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return max_vector_size(bt); // Same as max.
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
return Matcher::max_vector_size(bt);
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
// Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -2017,7 +2017,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return MIN2(size, max_size);
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
return Matcher::max_vector_size(bt);
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/riscv_v.ad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2020, 2023, Arm Limited. All rights reserved.
// Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
Expand Down Expand Up @@ -46,7 +46,7 @@ source %{
}
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
return match_rule_supported_vector(opcode, vlen, bt);
}

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/s390/s390.ad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2017, 2022 SAP SE. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
Expand Down Expand Up @@ -1513,7 +1513,7 @@ bool Matcher::match_rule_supported(int opcode) {
return true; // Per default match rules are supported.
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
return match_rule_supported_vector(opcode, vlen, bt);
}

Expand Down Expand Up @@ -1574,7 +1574,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return max_vector_size(bt); // Same as max.
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
return Matcher::max_vector_size(bt);
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/x86.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ static inline bool is_pop_count_instr_target(BasicType bt) {
(is_non_subword_integral_type(bt) && VM_Version::supports_avx512_vpopcntdq());
}

bool Matcher::match_rule_supported_superword(int opcode, int vlen, BasicType bt) {
bool Matcher::match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt) {
return match_rule_supported_vector(opcode, vlen, bt);
}

Expand Down Expand Up @@ -2280,7 +2280,7 @@ int Matcher::min_vector_size(const BasicType bt) {
return MIN2(size,max_size);
}

int Matcher::superword_max_vector_size(const BasicType bt) {
int Matcher::max_vector_size_auto_vectorization(const BasicType bt) {
// Limit the max vector size for auto vectorization to 256 bits (32 bytes)
// by default on Cascade Lake
if (VM_Version::is_default_intel_cascade_lake()) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class Matcher : public PhaseTransform {

// Identify extra cases that we might want to vectorize automatically
// And exclude cases which are not profitable to auto-vectorize.
static bool match_rule_supported_superword(int opcode, int vlen, BasicType bt);
static bool match_rule_supported_auto_vectorization(int opcode, int vlen, BasicType bt);

// identify extra cases that we might want to provide match rules for
// e.g. Op_ vector nodes and other intrinsics while guarding with vlen
Expand All @@ -355,7 +355,7 @@ class Matcher : public PhaseTransform {
Matcher::min_vector_size(bt) <= size);
}
// Limits on max vector size (number of elements) for auto-vectorization.
static int superword_max_vector_size(const BasicType bt);
static int max_vector_size_auto_vectorization(const BasicType bt);

// Actual max scalable vector register length.
static int scalable_vector_reg_size(const BasicType bt);
Expand Down
18 changes: 9 additions & 9 deletions src/hotspot/share/opto/superword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) {
ignored_loop_nodes[i] = -1;
}

int max_vector = Matcher::superword_max_vector_size(T_BYTE);
int max_vector = Matcher::max_vector_size_auto_vectorization(T_BYTE);

// Process the loop, some/all of the stack entries will not be in order, ergo
// need to preprocess the ignored initial state before we process the loop
Expand Down Expand Up @@ -291,7 +291,7 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) {

if (is_java_primitive(bt) == false) continue;

int cur_max_vector = Matcher::superword_max_vector_size(bt);
int cur_max_vector = Matcher::max_vector_size_auto_vectorization(bt);

// If a max vector exists which is not larger than _local_loop_unroll_factor
// stop looking, we already have the max vector to map to.
Expand Down Expand Up @@ -789,13 +789,13 @@ int SuperWord::get_vw_bytes_special(MemNode* s) {
}
}
if (should_combine_adjacent) {
vw = MIN2(Matcher::superword_max_vector_size(btype)*type2aelembytes(btype), vw * 2);
vw = MIN2(Matcher::max_vector_size_auto_vectorization(btype)*type2aelembytes(btype), vw * 2);
}
}

// Check for special case where there is a type conversion between different data size.
int vectsize = max_vector_size_in_def_use_chain(s);
if (vectsize < Matcher::superword_max_vector_size(btype)) {
if (vectsize < Matcher::max_vector_size_auto_vectorization(btype)) {
vw = MIN2(vectsize * type2aelembytes(btype), vw);
}

Expand Down Expand Up @@ -969,8 +969,8 @@ bool SuperWord::stmts_can_pack(Node* s1, Node* s2, int align) {
if(!is_java_primitive(bt1) || !is_java_primitive(bt2))
return false;
BasicType longer_bt = longer_type_for_conversion(s1);
if (Matcher::superword_max_vector_size(bt1) < 2 ||
(longer_bt != T_ILLEGAL && Matcher::superword_max_vector_size(longer_bt) < 2)) {
if (Matcher::max_vector_size_auto_vectorization(bt1) < 2 ||
(longer_bt != T_ILLEGAL && Matcher::max_vector_size_auto_vectorization(longer_bt) < 2)) {
return false; // No vectors for this type
}

Expand Down Expand Up @@ -3018,7 +3018,7 @@ bool SuperWord::construct_bb() {
// First see if we can map the reduction on the given system we are on, then
// make a data entry operation for each reduction we see.
BasicType bt = use->bottom_type()->basic_type();
if (ReductionNode::implemented(use->Opcode(), Matcher::superword_max_vector_size(bt), bt)) {
if (ReductionNode::implemented(use->Opcode(), Matcher::max_vector_size_auto_vectorization(bt), bt)) {
reduction_uses++;
}
}
Expand Down Expand Up @@ -3172,10 +3172,10 @@ int SuperWord::max_vector_size_in_def_use_chain(Node* n) {
vt = (newt == T_ILLEGAL) ? vt : newt;
}

int max = Matcher::superword_max_vector_size(vt);
int max = Matcher::max_vector_size_auto_vectorization(vt);
// If now there is no vectors for the longest type, the nodes with the longest
// type in the def-use chain are not packed in SuperWord::stmts_can_pack.
return max < 2 ? Matcher::superword_max_vector_size(bt) : max;
return max < 2 ? Matcher::max_vector_size_auto_vectorization(bt) : max;
}

//-------------------------compute_vector_element_type-----------------------
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/opto/vectornode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ int VectorNode::scalar_opcode(int sopc, BasicType bt) {

// Limits on vector size (number of elements) for auto-vectorization.
bool VectorNode::vector_size_supported_superword(const BasicType bt, int size) {
return Matcher::superword_max_vector_size(bt) >= size &&
return Matcher::max_vector_size_auto_vectorization(bt) >= size &&
Matcher::min_vector_size(bt) <= size;
}

Expand All @@ -409,7 +409,7 @@ bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
if (VectorNode::is_vector_integral_negate(vopc)) {
return is_vector_integral_negate_supported(vopc, vlen, bt, false);
}
return vopc > 0 && Matcher::match_rule_supported_superword(vopc, vlen, bt);
return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, bt);
}
return false;
}
Expand Down Expand Up @@ -1434,7 +1434,7 @@ bool VectorCastNode::implemented(int opc, uint vlen, BasicType src_type, BasicTy
(vlen > 1) && is_power_of_2(vlen) &&
VectorNode::vector_size_supported_superword(dst_type, vlen)) {
int vopc = VectorCastNode::opcode(opc, src_type);
return vopc > 0 && Matcher::match_rule_supported_superword(vopc, vlen, dst_type);
return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, dst_type);
}
return false;
}
Expand Down Expand Up @@ -1528,7 +1528,7 @@ bool ReductionNode::implemented(int opc, uint vlen, BasicType bt) {
(vlen > 1) && is_power_of_2(vlen) &&
VectorNode::vector_size_supported_superword(bt, vlen)) {
int vopc = ReductionNode::opcode(opc, bt);
return vopc != opc && Matcher::match_rule_supported_superword(vopc, vlen, bt);
return vopc != opc && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, bt);
}
return false;
}
Expand Down

1 comment on commit f0bae79

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.