Skip to content

Commit

Permalink
Improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
reinrich committed May 14, 2024
1 parent 63e37a1 commit 9cbe964
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/hotspot/jtreg/compiler/c2/TestMergeStores.java
Original file line number Diff line number Diff line change
Expand Up @@ -1653,20 +1653,23 @@ static Object[] test800R(byte[] a, int offset, long v) {
applyIf = {"UseUnalignedAccesses", "true"},
applyIfPlatform = {"big-endian", "true"})
static Object[] test800a(byte[] a, int offset, long v) {
// Merge attempts begin at the lowest store in the Memory chain.
// Candidates are found following the chain. The list is trimmed to a
// power of 2 length by removing higher stores.
if (IS_BIG_ENDIAN) {
a[offset + 0] = (byte)(v >> 40);
a[offset + 1] = (byte)(v >> 32);
a[offset + 2] = (byte)(v >> 24); // The lowest stores in the Memory chain can be merged.
a[offset + 3] = (byte)(v >> 16); // This is possible because the input for the merged store
a[offset + 4] = (byte)(v >> 8); // does not require a right shift.
a[offset + 0] = (byte)(v >> 40); // Removed from candidate list
a[offset + 1] = (byte)(v >> 32); // Removed from candidate list
a[offset + 2] = (byte)(v >> 24); // The 4 following stores are on the candidate list
a[offset + 3] = (byte)(v >> 16); // and they are successfully merged.
a[offset + 4] = (byte)(v >> 8);
a[offset + 5] = (byte)(v >> 0);
} else {
a[offset + 0] = (byte)(v >> 0);
a[offset + 1] = (byte)(v >> 8);
a[offset + 2] = (byte)(v >> 16); // The merge is tried with the lowest store in the Memory chain.
a[offset + 3] = (byte)(v >> 24); // It fails because the 2 highest stores are ignored aiming for a 4 byte store
a[offset + 4] = (byte)(v >> 32); // but this would then require a right shift by 16 to get the input
a[offset + 5] = (byte)(v >> 40); // for the merge store.
a[offset + 0] = (byte)(v >> 0); // Removed from candidate list
a[offset + 1] = (byte)(v >> 8); // Removed from candidate list
a[offset + 2] = (byte)(v >> 16); // The 4 following stores are on the candidate list.
a[offset + 3] = (byte)(v >> 24); // They cannot be merged though because this would require shifting
a[offset + 4] = (byte)(v >> 32); // The input.
a[offset + 5] = (byte)(v >> 40);
}
return new Object[]{ a };
}
Expand Down

0 comments on commit 9cbe964

Please sign in to comment.