Skip to content

Commit 1a8212e

Browse files
committed
8348678: [PPC64] C2: unaligned vector load/store is ok
8343906: test2 of compiler/c2/TestCastX2NotProcessedIGVN.java fails on some platforms Reviewed-by: mdoerr, amitkumar
1 parent 41bdc47 commit 1a8212e

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/hotspot/cpu/ppc/matcher_ppc.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -37,10 +37,12 @@
3737
return false;
3838
}
3939

40-
// PPC implementation uses VSX load/store instructions (if
41-
// SuperwordUseVSX) which support 4 byte but not arbitrary alignment
40+
// The PPC implementation uses VSX lxvd2x/stxvd2x instructions (if
41+
// SuperwordUseVSX). They do not have alignment requirements.
42+
// Some VSX storage access instructions cannot encode arbitrary displacements
43+
// (e.g. lxv). None of them is currently used.
4244
static constexpr bool misaligned_vectors_ok() {
43-
return false;
45+
return true;
4446
}
4547

4648
// Whether code generation need accurate ConvI2L types.

src/hotspot/cpu/ppc/vm_version_ppc.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
3+
* Copyright (c) 2012, 2025 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -131,6 +131,9 @@ void VM_Version::initialize() {
131131
}
132132
}
133133
MaxVectorSize = SuperwordUseVSX ? 16 : 8;
134+
if (FLAG_IS_DEFAULT(AlignVector)) {
135+
FLAG_SET_ERGO(AlignVector, false);
136+
}
134137

135138
if (PowerArchitecturePPC64 >= 9) {
136139
if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionsPPC64)) {

test/hotspot/jtreg/compiler/c2/TestCastX2NotProcessedIGVN.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2024, Red Hat, Inc. All rights reserved.
3-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@ public static void test1Runner() {
7777
@Test
7878
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 1"},
7979
applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"},
80-
applyIfPlatformOr = {"x64", "true", "aarch64", "true"})
80+
applyIfPlatformOr = {"x64", "true", "aarch64", "true", "ppc", "true"})
8181
public static int test2(int stop, int[] array) {
8282
int v = 0;
8383
stop = Math.min(stop, Integer.MAX_VALUE / 4);

0 commit comments

Comments
 (0)