mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
Apply changes from review
This commit is contained in:
parent
133783686d
commit
9e74df5fef
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
|
||||
@ -261,7 +261,8 @@ VTransformNode* SuperWordVTransformBuilder::get_or_make_vtnode_vector_input_at_i
|
||||
// If the use and def types are different, emit a cast node
|
||||
if (use_bt != def_bt && !p0->is_Convert() && VectorCastNode::is_supported_subword_cast(def_bt, use_bt, pack->size())) {
|
||||
VTransformNode* in = get_vtnode(pack_in->at(0));
|
||||
VTransformNode* cast = new (_vtransform.arena()) VTransformCastVectorNode(_vtransform, pack->size(), def_bt, use_bt);
|
||||
const VTransformVectorNodeProperties properties = VTransformVectorNodeProperties::make_from_pack(pack, _vloop_analyzer);
|
||||
VTransformNode* cast = new (_vtransform.arena()) VTransformElementWiseVectorNode(_vtransform, 2, properties, VectorCastNode::opcode(-1, def_bt));
|
||||
cast->set_req(1, in);
|
||||
|
||||
return cast;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
|
||||
@ -1310,7 +1310,8 @@ bool VTransformReductionVectorNode::optimize_move_non_strict_order_reductions_ou
|
||||
return false; // not compatible
|
||||
}
|
||||
|
||||
if (current_red->in_req(2)->isa_Vector() == nullptr && current_red->in_req(2)->isa_CastVector() == nullptr) {
|
||||
VTransformVectorNode* vector_input = current_red->in_req(2)->isa_Vector();
|
||||
if (vector_input == nullptr) {
|
||||
assert(false, "reduction has a bad vector input");
|
||||
return false;
|
||||
}
|
||||
@ -1540,24 +1541,11 @@ VTransformApplyResult VTransformStoreVectorNode::apply(VTransformApplyState& app
|
||||
return VTransformApplyResult::make_vector(vn, vn->vect_type());
|
||||
}
|
||||
|
||||
float VTransformCastVectorNode::cost(const VLoopAnalyzer& vloop_analyzer) const {
|
||||
return vloop_analyzer.cost_for_vector_node(VectorCastNode::opcode(-1, _from_bt), _vlen, _from_bt);
|
||||
}
|
||||
|
||||
VTransformApplyResult VTransformCastVectorNode::apply(VTransformApplyState& apply_state) const {
|
||||
Node* value = apply_state.transformed_node(in_req(1));
|
||||
VectorNode* vn = VectorCastNode::make(VectorCastNode::opcode(-1, _from_bt), value, _to_bt, _vlen);
|
||||
register_new_node_from_vectorization(apply_state, vn);
|
||||
|
||||
return VTransformApplyResult::make_vector(vn, vn->vect_type());
|
||||
}
|
||||
|
||||
void VTransformNode::register_new_node_from_vectorization(VTransformApplyState& apply_state, Node* vn) const {
|
||||
PhaseIdealLoop* phase = apply_state.phase();
|
||||
// Using the cl is sometimes not the most accurate, but still correct. We do not have to be
|
||||
// perfectly accurate, because we will set major_progress anyway.
|
||||
phase->register_new_node(vn, apply_state.vloop().cl());
|
||||
|
||||
phase->igvn()._worklist.push(vn);
|
||||
VectorNode::trace_new_vector(vn, "AutoVectorization");
|
||||
}
|
||||
@ -1658,10 +1646,6 @@ void VTransformPopulateIndexNode::print_spec() const {
|
||||
tty->print("vlen=%d element_bt=%s", _vlen, type2name(_element_bt));
|
||||
}
|
||||
|
||||
void VTransformCastVectorNode::print_spec() const {
|
||||
tty->print("vlen=%d from=%s to=%s", _vlen, type2name(_from_bt), type2name(_to_bt));
|
||||
}
|
||||
|
||||
void VTransformVectorNode::print_spec() const {
|
||||
tty->print("Properties[orig=[%d %s] sopc=%s vlen=%d element_bt=%s]",
|
||||
approximate_origin()->_idx,
|
||||
|
||||
@ -93,7 +93,6 @@ class VTransformPhiVectorNode;
|
||||
class VTransformMemVectorNode;
|
||||
class VTransformLoadVectorNode;
|
||||
class VTransformStoreVectorNode;
|
||||
class VTransformCastVectorNode;
|
||||
|
||||
// Result from VTransformNode::apply
|
||||
class VTransformApplyResult {
|
||||
@ -588,7 +587,6 @@ public:
|
||||
virtual VTransformMemVectorNode* isa_MemVector() { return nullptr; }
|
||||
virtual VTransformLoadVectorNode* isa_LoadVector() { return nullptr; }
|
||||
virtual VTransformStoreVectorNode* isa_StoreVector() { return nullptr; }
|
||||
virtual VTransformCastVectorNode* isa_CastVector() { return nullptr; }
|
||||
|
||||
virtual bool is_load_in_loop() const { return false; }
|
||||
virtual bool is_load_or_store_in_loop() const { return false; }
|
||||
@ -978,21 +976,4 @@ public:
|
||||
NOT_PRODUCT(virtual const char* name() const override { return "StoreVector"; };)
|
||||
};
|
||||
|
||||
class VTransformCastVectorNode : public VTransformNode {
|
||||
private:
|
||||
uint _vlen;
|
||||
BasicType _from_bt;
|
||||
BasicType _to_bt;
|
||||
|
||||
public:
|
||||
// req = 2 -> [ctrl, input]
|
||||
VTransformCastVectorNode(VTransform& vtransform, int vlen, BasicType from_bt, BasicType to_bt) : VTransformNode(vtransform, 2),
|
||||
_vlen(vlen), _from_bt(from_bt), _to_bt(to_bt) {}
|
||||
virtual VTransformCastVectorNode* isa_CastVector() override { return this; }
|
||||
virtual VTransformApplyResult apply(VTransformApplyState& apply_state) const override;
|
||||
virtual float cost(const VLoopAnalyzer& vloop_analyzer) const override;
|
||||
NOT_PRODUCT(virtual const char* name() const override { return "CastVector"; };)
|
||||
NOT_PRODUCT(virtual void print_spec() const override;)
|
||||
};
|
||||
|
||||
#endif // SHARE_OPTO_VTRANSFORM_HPP
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -30,7 +31,7 @@ import java.util.Random;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8294816
|
||||
* @bug 8294816 8342095
|
||||
* @key randomness
|
||||
* @summary Test Math.min/max vectorization miscompilation for integer subwords
|
||||
* @library /test/lib /
|
||||
@ -62,7 +63,7 @@ public class TestMinMaxSubword {
|
||||
// types and superword should generate int versions and then cast between them.
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE + "min(max_int, max_short)", ">0" })
|
||||
public static void testMinShort() {
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
sb[i] = (short) Math.min(sa[i], val);
|
||||
@ -78,7 +79,7 @@ public class TestMinMaxSubword {
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE + "min(max_int, max_short)", ">0" })
|
||||
public static void testMaxShort() {
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
sb[i] = (short) Math.max(sa[i], val);
|
||||
@ -93,7 +94,7 @@ public class TestMinMaxSubword {
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2B, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2B, IRNode.VECTOR_SIZE + "min(max_int, max_byte)", ">0" })
|
||||
public static void testMinByte() {
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
bb[i] = (byte) Math.min(ba[i], val);
|
||||
@ -109,7 +110,7 @@ public class TestMinMaxSubword {
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2B, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2B, IRNode.VECTOR_SIZE + "min(max_int, max_byte)", ">0" })
|
||||
public static void testMaxByte() {
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
bb[i] = (byte) Math.max(ba[i], val);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 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
|
||||
@ -34,7 +34,7 @@ import java.nio.ByteOrder;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8325155
|
||||
* @bug 8325155 8342095
|
||||
* @key randomness
|
||||
* @summary Test some cases that vectorize after the removal of the alignment boundaries code.
|
||||
* Now, we instead check if use-def connections have compatible type size.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test id=no-vectorization
|
||||
* @bug 8340093
|
||||
* @bug 8340093 8342095
|
||||
* @summary Test vectorization of reduction loops.
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestReductions P0
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
/*
|
||||
* @test id=vanilla
|
||||
* @bug 8340093
|
||||
* @bug 8340093 8342095
|
||||
* @summary Test vectorization of reduction loops.
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestReductions P1
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
/*
|
||||
* @test id=force-vectorization
|
||||
* @bug 8340093
|
||||
* @bug 8340093 8342095
|
||||
* @summary Test vectorization of reduction loops.
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestReductions P2
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2025 Loongson Technology Co. Ltd. All rights reserved.
|
||||
* Copyright (c) 2025, Rivos Inc. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -24,7 +25,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8286847 8353600
|
||||
* @bug 8286847 8353600 8342095
|
||||
* @key randomness
|
||||
* @summary Test vectorization of rotate byte and short
|
||||
* @library /test/lib /
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.g
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,7 +29,7 @@ import compiler.lib.generators.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8350177 8362171 8369881
|
||||
* @bug 8350177 8362171 8369881 8342095
|
||||
* @summary Ensure that truncation of subword vectors produces correct results
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.vectorization.TestSubwordTruncation
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 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
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -23,6 +24,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8183390 8342095
|
||||
* @summary Vectorization test on basic short operations
|
||||
* @library /test/lib /
|
||||
*
|
||||
@ -213,7 +215,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
||||
// Min/Max vectorization requires a cast from subword to int and back to subword, to avoid losing the higher order bits.
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE + "min(max_int, max_short)", ">0" })
|
||||
public short[] vectorMin() {
|
||||
short[] res = new short[SIZE];
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
@ -223,7 +225,7 @@ public class BasicShortOpTest extends VectorizationTestRunner {
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE_ANY, ">0" })
|
||||
@IR(applyIfCPUFeature = { "avx", "true" }, counts = { IRNode.VECTOR_CAST_I2S, IRNode.VECTOR_SIZE + "min(max_int, max_short)", ">0" })
|
||||
public short[] vectorMax() {
|
||||
short[] res = new short[SIZE];
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user