Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hotspot/share/opto/matcher.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -327,6 +327,8 @@ class Matcher : public PhaseTransform {
// e.g. Op_ vector nodes and other intrinsics while guarding with vlen
static bool match_rule_supported_vector(int opcode, int vlen, BasicType bt);

// Returns true if the platform efficiently implements the given masked vector
// operation using predicate features, false otherwise.
static bool match_rule_supported_vector_masked(int opcode, int vlen, BasicType bt);

// Determines if a vector operation needs to be partially implemented with a mask
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/opto/node.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Alibaba Group Holding Limited. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -843,7 +843,8 @@ class Node {
Flag_has_swapped_edges = 1ULL << 11,
Flag_is_scheduled = 1ULL << 12,
Flag_is_expensive = 1ULL << 13,
Flag_is_predicated_vector = 1ULL << 14,
Flag_is_predicated_vector = 1ULL << 14, // Marked on a vector node that has an additional
// mask input controlling the lane operations.
Flag_for_post_loop_opts_igvn = 1ULL << 15,
Flag_for_merge_stores_igvn = 1ULL << 16,
Flag_is_removed_by_peephole = 1ULL << 17,
Expand Down
8 changes: 7 additions & 1 deletion src/hotspot/share/opto/type.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -2443,6 +2443,12 @@ const TypeVect* TypeVect::make(BasicType elem_bt, uint length, bool is_mask) {
return nullptr;
}

// Create a vector mask type with the given element basic type and length.
// - Returns "TypeVectMask" (PVectMask) for platforms that support the predicate
// feature and it is implemented properly in the backend, allowing the mask to
// be stored in a predicate/mask register.
// - Returns a normal vector type "TypeVectA ~ TypeVectZ" (NVectMask) otherwise,
// where the vector mask is stored in a vector register.
const TypeVect* TypeVect::makemask(BasicType elem_bt, uint length) {
if (Matcher::has_predicated_vectors() &&
Matcher::match_rule_supported_vector_masked(Op_VectorLoadMask, length, elem_bt)) {
Expand Down
17 changes: 15 additions & 2 deletions src/hotspot/share/opto/type.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1012,7 +1012,7 @@ class TypeAry : public Type {
};

//------------------------------TypeVect---------------------------------------
// Class of Vector Types
// Basic class of vector (mask) types.
class TypeVect : public Type {
const BasicType _elem_bt; // Vector's element type
const uint _length; // Elements in vector (power of 2)
Expand Down Expand Up @@ -1052,6 +1052,16 @@ class TypeVect : public Type {
#endif
};

// TypeVect subclasses representing vectors or vector masks with "BVectMask" or "NVectMask"
// layout (see vectornode.hpp for detailed notes on vector mask representations), mapped
// to vector registers and distinguished by vector register size:
//
// - TypeVectA: Scalable vector type (variable size, e.g., AArch64 SVE, RISC-V RVV)
// - TypeVectS: 32-bit vector type
// - TypeVectD: 64-bit vector type
// - TypeVectX: 128-bit vector type
// - TypeVectY: 256-bit vector type
// - TypeVectZ: 512-bit vector type
class TypeVectA : public TypeVect {
friend class TypeVect;
TypeVectA(BasicType elem_bt, uint length) : TypeVect(VectorA, elem_bt, length) {}
Expand Down Expand Up @@ -1082,6 +1092,9 @@ class TypeVectZ : public TypeVect {
TypeVectZ(BasicType elem_bt, uint length) : TypeVect(VectorZ, elem_bt, length) {}
};

// Class of TypeVectMask, representing vector masks with "PVectMask" layout (see
// vectornode.hpp for detailed notes on vector mask representations), mapped to
// dedicated hardware predicate/mask registers.
class TypeVectMask : public TypeVect {
public:
friend class TypeVect;
Expand Down
Loading