From 1a8212e1018744b360df310e85fc29f8c41f5072 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Tue, 11 Feb 2025 07:45:55 +0000 Subject: [PATCH] 8348678: [PPC64] C2: unaligned vector load/store is ok 8343906: test2 of compiler/c2/TestCastX2NotProcessedIGVN.java fails on some platforms Reviewed-by: mdoerr, amitkumar --- src/hotspot/cpu/ppc/matcher_ppc.hpp | 10 ++++++---- src/hotspot/cpu/ppc/vm_version_ppc.cpp | 5 ++++- .../jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/hotspot/cpu/ppc/matcher_ppc.hpp b/src/hotspot/cpu/ppc/matcher_ppc.hpp index aaac79325c4..441339b94c6 100644 --- a/src/hotspot/cpu/ppc/matcher_ppc.hpp +++ b/src/hotspot/cpu/ppc/matcher_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -37,10 +37,12 @@ return false; } - // PPC implementation uses VSX load/store instructions (if - // SuperwordUseVSX) which support 4 byte but not arbitrary alignment + // The PPC implementation uses VSX lxvd2x/stxvd2x instructions (if + // SuperwordUseVSX). They do not have alignment requirements. + // Some VSX storage access instructions cannot encode arbitrary displacements + // (e.g. lxv). None of them is currently used. static constexpr bool misaligned_vectors_ok() { - return false; + return true; } // Whether code generation need accurate ConvI2L types. diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp index 6aada789c1d..8ec69bffe15 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2024 SAP SE. All rights reserved. + * Copyright (c) 2012, 2025 SAP SE. 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 @@ -131,6 +131,9 @@ void VM_Version::initialize() { } } MaxVectorSize = SuperwordUseVSX ? 16 : 8; + if (FLAG_IS_DEFAULT(AlignVector)) { + FLAG_SET_ERGO(AlignVector, false); + } if (PowerArchitecturePPC64 >= 9) { if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionsPPC64)) { diff --git a/test/hotspot/jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java b/test/hotspot/jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java index ca5a754f296..dab2585c500 100644 --- a/test/hotspot/jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java +++ b/test/hotspot/jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2024, Red Hat, Inc. All rights reserved. - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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 @@ -77,7 +77,7 @@ public class TestCastX2NotProcessedIGVN { @Test @IR(counts = {IRNode.LOAD_VECTOR_I, "> 1"}, applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"}, - applyIfPlatformOr = {"x64", "true", "aarch64", "true"}) + applyIfPlatformOr = {"x64", "true", "aarch64", "true", "ppc", "true"}) public static int test2(int stop, int[] array) { int v = 0; stop = Math.min(stop, Integer.MAX_VALUE / 4);