Skip to content

Commit

Permalink
[Backport] 8272413: Incorrect num of element count calculation for ve…
Browse files Browse the repository at this point in the history
…ctor cast

Summary: 8272413: Incorrect num of element count calculation for vector cast

Test Plan: ci jtreg

Reviewed-by: JoshuaZhuwj

Issue: dragonwell-project#573
  • Loading branch information
JinZhonghui committed Dec 7, 2023
1 parent 06cf16b commit 98b76b9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/hotspot/share/opto/vectorIntrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,8 +1674,7 @@ bool LibraryCallKit::inline_vector_convert() {
if (num_elem_from < num_elem_to) {
// Since input and output number of elements are not consistent, we need to make sure we
// properly size. Thus, first make a cast that retains the number of elements from source.
// In case the size exceeds the arch size, we do the minimum.
int num_elem_for_cast = MIN2(num_elem_from, Matcher::max_vector_size(elem_bt_to));
int num_elem_for_cast = num_elem_from;

// It is possible that arch does not support this intermediate vector size
// TODO More complex logic required here to handle this corner case for the sizes.
Expand All @@ -1694,7 +1693,7 @@ bool LibraryCallKit::inline_vector_convert() {
} else if (num_elem_from > num_elem_to) {
// Since number elements from input is larger than output, simply reduce size of input (we are supposed to
// drop top elements anyway).
int num_elem_for_resize = MAX2(num_elem_to, Matcher::min_vector_size(elem_bt_from));
int num_elem_for_resize = num_elem_to;

// It is possible that arch does not support this intermediate vector size
// TODO More complex logic required here to handle this corner case for the sizes.
Expand Down

0 comments on commit 98b76b9

Please sign in to comment.